AJAX中的NS_ERROR_DOM_BAD_URI

I have part AJAX code, but it returns statustext "NS_ERROR_DOM_BAD_URI: Access to restricted URI denied" Some parts in $.ajax I had added, but nothing changed

From this url I become just a number, without html or xml tags

    $.ajax({
    url: route, //here is my link, when open in browser all is ok
    type: 'GET',
    dataType: '_default', //was text
    username: username,  
    password: password ,

    crossDomain:true, //added
    xhrFields: { withCredentials: true }, //added
    success: function(data1) {      

               console.log(data1);
               alert(data1);
    },
    error: function(err){console.log(err);
               alert(err);}
     ,beforeSend: function (xhr) {                          
            xhr.setRequestHeader("Access-Control-Allow-Origin", "*");  //added
    },
        headers: {
        'Access-Control-Allow-Origin': '*'}  //added


})

I have tested it in Firefox

查看全部
weixin_33698823
weixin_33698823
2015/02/05 13:56
  • ajax
  • javascript
  • jquery
  • 点赞
  • 收藏
  • 回答
    私信

2个回复