jQuery ajaxSend()在FF工作,但不是Chrome

jQuery ajaxSend() working in FF but not Chrome?

本文关键字:Chrome 工作 FF ajaxSend jQuery      更新时间:2023-09-26

这段代码在FF中工作正常,但在Chrome中不行。sendRequest();呼叫$.ajax()请求

sendRequest('post')
$('#status').ajaxSend(function() {
  $(this).removeClass();
  $(this).html('Posting...');
});

你知道为什么这不能在Chrome中工作吗?有趣的是,如果我把alert()放在ajaxSend()的末尾,我的帖子……'被添加到div中,但如果警告不存在,则不会更改。

以下是$.ajax()代码:

$.ajax({type: "POST",
  url: "ajaxRequest.php", 
  data: varString,
  dataType: "text",
  async:false,
  success: function(data){
    if(data == "1"){
    return true;
  }
  else{
   return false;    
  }
});

显然我不能留下评论,但我需要问:你留下了吗?在代码的最后?看起来您结束了JSON集,但没有结束ajax方法。