[英]ajaxStart does not work on Ajax Post
I have ajaxStart event that is working fine for ajax loads. 我有一个ajaxStart事件,对于ajax加载工作正常。 But when I do a POST is not working at all.
但是当我执行POST时根本无法正常工作。
Here the code that is always render per all pages. 在这里,始终按所有页面呈现的代码。
$(document).ajaxComplete(function () {
hideIcon();
if (stepState !== '' && stepState !== CONSTANTS.DISABLED_FORM) {
enableElement();
}
});
$(document).ajaxStart(function () {
showIcon();
disableElement();
});
And here my post. 这是我的帖子
var sendRequest = function (url, data) {
$.ajaxPrefilter(function( options ) {
options.global = true;
});
$.ajax({
dataType: "json",
method: "POST",
url: url,
data: data,
success: function (data) {
applicationAlerts.showStatus(data);
loadDocumentGroup();
}
});
};
I follow this tickets here https://forum.jquery.com/topic/ajaxstart-is-not-working , but in my case does not work. 我在这里https://forum.jquery.com/topic/ajaxstart-is-not-working上遵循此票证,但是在我的情况下不起作用。
I´m using JQuery 1.11 我正在使用JQuery 1.11
Any suggestion?. 有什么建议吗? Thanks!
谢谢!
I think you made mistake in ajax
function.Try to change like this 我认为您在
ajax
函数中犯了错误。尝试像这样更改
$.ajax({
dataType: "json",
type: "POST",
.....
});
There is no Parameter like method
in ajax
Request.You need to use type
parameter to specify the type of Request.(GET OR POST) ajax
Request中没有类似Parameter的method
。您需要使用type
参数来指定Request的类型。(GET或POST)
Hope it will works!. 希望它能工作! Thanks
谢谢
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.