jQuery $.get/$.ajax passes HTTP status code 200 instead of expected status code of 201 or 202

后端 未结 1 404
名媛妹妹
名媛妹妹 2021-01-17 14:39

I\'ve a server that returns HTTP status code 200, 201, and 202 from the same url. In Chrome, I\'ve confirmed with the Network debugging panel that the Status Code is what I

1条回答
  •  有刺的猬
    2021-01-17 14:41

    From what I have experienced jQuery is just not set up very well for handling actual status codes in the response. You can try just doing a manual AJAX call using some good old bare bones JS and handle the status yourself.

    Here are a few tutorials on how to do so.

    http://www.degraeve.com/reference/simple-ajax-example.php

    http://www.w3schools.com/ajax/default.asp

    request.status is where you should be able to access the status code in your request object. Here is another page showing a little bit about how to access even more granular information about the status of the request.

    http://www.ibm.com/developerworks/web/library/wa-ajaxintro3/

    Hope that helps you nail it!

    0 讨论(0)
提交回复
热议问题