Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery: Content type header is not set
    text
    copied!<p>I am trying to send crossdomain ajax GET request</p> <pre><code>$(document).ready(function(){ $.ajax ({ type: "GET", url: "url", cache: false, contentType: "application/x-www-form-urlencoded", dataType: "jsonp", beforeSend: function (xhr){ xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.setRequestHeader('Authorization', make_base_auth("login", "pwd")); }, success: function (data, success){ console.log("success", arguments); }, error: function(jqXHR, textStatus, errorThrown) { console.log("error", arguments); }, complete: function(jqxhr, textStatus) { console.log("complete", arguments); } }); }); </code></pre> <p>The server only accepts application/x-www-form-urlencoded data. After sending the request I receive response with 415 status (Unsupported media type) When I check headers in firebug, I don't see Content-Type header at all.</p> <pre><code>GET /url?callback=jsonp1374315852923&amp;_=1374315854258 HTTP/1.1 Host: hostname User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:22.0) Gecko/20100101 Firefox/22.0 Accept: */* Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate Referer: http://refferer Cookie: JSESSIONID=1DCD5D9EB35FEF083C7EAF8F7EA25D54; ltime=1374315850; lid=30000379384174; SESS826f62d511330ecdaa9034d04e399c65=qj2jcempp4osi2hc00lq1jnkp1; AA_SESS=2c-30f9987cd946; AA_UID=0fe8965d05c37706a5bfbec88629ed68 Authorization: Basic YWthdml0YTpQNlBhdQ== Connection: keep-alive </code></pre> <p>Would appreciate your comments very much!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload