Ajax request returns 200 OK, but an error event is fired instead of success

后端 未结 16 2108
难免孤独
难免孤独 2020-11-22 04:12

I have implemented an Ajax request on my website, and I am calling the endpoint from a webpage. It always returns 200 OK, but jQuery execut

16条回答
  •  悲哀的现实
    2020-11-22 04:29

    I had the same issue. My problem was my controller was returning a status code instead of JSON. Make sure that your controller returns something like:

    public JsonResult ActionName(){
       // Your code
       return Json(new { });
    }
    

提交回复
热议问题