简体   繁体   中英

Getting the Error on making ajax call?

I have made an Ajax call to one of my pages sitting in the server. When I am making the Ajax call, I am not getting the data. But instead I am getting status 200 OK with red font-color in the firebug. I am not able to figure out what the problem is.

I am making an ajax call to these api pages:

  [{"ID":"001","name":"Naidu","school":"Hyd","hobby":"cricket"}]

My ajax call is like:

  $.ajax({ url: 'http://something.com/api/name',
       data:{},
     type: 'post',
      dataType: "json",
    success: function(output) {
     //alert("SUCCESS");
      alert(output);
    }});

Make sure API returns a status message when call is made.

Also retured output should be in json format. If you want to see exact output even if that is not json , remove DataType:"json" part from script and you should be able to see exact response.

Chances are that API isnt returning a message in one of the two cases or returned output is not json datatype.

确保您没有在执行跨域Ajax。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM