jQuery AJAX error handling

前端 未结 4 1764
半阙折子戏
半阙折子戏 2020-12-16 05:56

I\'ve searched the questions on here, but I don\'t have a good understanding of how to use the error handling in jQuery\'s AJAX (im a noob, so it just really doesn\'t make s

4条回答
  •  心在旅途
    2020-12-16 06:28

    Even though it's not your problem, I'll post here since it's related.

    With the recent JQuery v1.4 release, JSON responses are now validated. It broke my app because I returned:

     {success:true}
    

    and now it's required to be

     {"success":true} // HAS to be double quotes, single won't do it
    

    If incorrect, it calls the error handler. Easy fix but took a bit to figure out.

提交回复
热议问题