jQuery AJAX error handling

前端 未结 4 1744
半阙折子戏
半阙折子戏 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:07

    This is only 1 approach. I am building an application that returns all of its data in JSON. If there is an error then the JSON message is changed to reflect this. Every return object has a "status" of either "success" or "error". If it is an error then there is an "error_message" part of the JSON that describes the error.

    I hope that helps.

提交回复
热议问题