Basic Authentication using jQuery/ajax
问题 I am trying to create basic authentication page where my form has three fields username password grant type On submitting a form I just want to display returned response from a server on my HTML in JSON format. My AJAX call to web service also requires Authorization header to be set. But somehow headers are not getting set. I am trying beforeSend : function(xhr) { xhr.setRequestHeader('Authorization', "Basic ******"); xhr.setRequestHeader("contentType", "application/json;charset=UTF-8"); }