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

You are setting the headers on the client. The header "Access-Control-Allow-Origin", "*" MUST BE SET on the server and sent in the response. Also, are you trying to go cross domain?

I cannot change answer from server, so I create PHP file with file_get_contents command and exec this. In php file:

<?php
header("Content-Type: text/html; charset=utf-8");
$url = *my url*;

$cred = sprintf( 'Authorization: Basic %s',
  base64_encode( 'login:pass' )
);
$opts = array(
  'http' => array(
    'method' => 'GET',
    'header' => $cred
  )
);
$ctx = stream_context_create( $opts );
$r=file_get_contents( $url, false, $ctx );
echo $r;
?>