jQuery 中的等效响应处理
Response Handling equivalent in jQuery
response.rjs() => 将整个响应评估为 Javascript,这是 Rails RJS 响应所要求的。
response.execute(fn) => 调用传递给它的函数对象。
.on(responseStatus) =>只有当服务器响应AJAX请求返回的状态码为responseStatus
时才执行响应函数。
但是 jQuery-
中的等价物是什么
POST(this.up('form').action, data);
response.rjs().on(200);
response.execute(function () {
qPanel.hidePanel();
}).on(200);
我已将库 application_handle-min.js 的代码转换为 ujs 并解决了问题。
response.rjs() => 将整个响应评估为 Javascript,这是 Rails RJS 响应所要求的。
response.execute(fn) => 调用传递给它的函数对象。
.on(responseStatus) =>只有当服务器响应AJAX请求返回的状态码为responseStatus
时才执行响应函数。
但是 jQuery-
POST(this.up('form').action, data);
response.rjs().on(200);
response.execute(function () {
qPanel.hidePanel();
}).on(200);
我已将库 application_handle-min.js 的代码转换为 ujs 并解决了问题。