title: Basic Authentication with jQuery.ajax request and jsonp
body: <p>I have some local html/js files with which I'd like to invoke some remote servers via https and eventually use Basic Authentication for the request.</p>
  
  <p>I am encountering two problems. First is that if I don't specify 'jsonp' for the dataType, jQuery.ajax() request returns the error:</p>
  
  <blockquote>
    <p>Access to restricted URI denied code:
    1012</p>
  </blockquote>
  
  <p>Are my requests considered cross-domain because my main work file is stored locally, but retrieving data from a server elsewhere? </p>
  
  <p>So fine, I update the call so it now looks like:</p>
  
  <pre><code>$.ajax({ 
       url: myServerUrl,
       type: "GET", 
       dataType: "jsonp", // considered a cross domain Ajax request if not specified
       username: myUsername,
       password: myPassword,
  
       success: function(result)
       {
          // success handling
       },
       error: function(req, status, errThrown){
           // error handling
       }
  })
  </code></pre>
  
  <p>Because I need to use Basic Authentication, I'm passing in the username/password but if I monitor the request, I don't see it being set and additionally, the server sends an error response since it doesn't have the expected info.</p>
  
  <p>Additionally, because I have <code>jsonp</code> set, <code>beforeSend</code> won't get invoked.</p>
  
  <p>How do I pass along the credentials using Basic Authentication for this request?</p>