Why is AJAX returning HTTP status code 0?

后端 未结 20 3065
野的像风
野的像风 2020-11-22 06:39

For some reason, while using AJAX (with my dashcode developed application) the browser just stops uploading and returns status codes of 0. Why does this happen?

20条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-22 07:21

    Observe the browser Console while making the request, if you are seeing "The Same Origin Policy disallows reading the remote resource at http ajax..... reason: cors header ‘access-control-allow-origin’ missing" then you need to add "Access-Control-Allow-Origin" in response header. exa: in java you can set this like response.setHeader("Access-Control-Allow-Origin", "*") where response is HttpServletResponse.

提交回复
热议问题