changed success function in js.