weixin_33725515 2016-04-13 11:30 采纳率: 0%
浏览 53

Ajax jQuery异常

I have a very basic problem related to ajax jquery , need some guidance

$.ajax({
   type:"get",
   url:"www.google.com",
   success: function(html) {
    alert("success");
    },

    error : function(request,status,error) {
    alert(status);} //edited
 });

I am getting status as "error" , error variable as "". I am not sure whats the problem . Check even with Verb "POST".

Edit : There was a typo in typing here. The syntax seems to be correct , even then the same error.

Here is the jsfiddle: https://jsfiddle.net/1988/z7nnf0fh/

  • 写回答

1条回答 默认 最新

  • weixin_33725270 2016-04-13 12:10
    关注

    Your url is the problem for the error

     $.ajax({
     type:"get",
     url:"https://httpbin.org/", //Remove the url here..
     success: function(html) {
       alert("success");
    },
    error : function(request,status,error) {
      alert(status);} //edited
    });
    

    After removing this URL, got success in alert. See on fiddle https://jsfiddle.net/smit_patel/0gety9oj/

    评论

报告相同问题?