[jQuery] i can't modify the header with "beforeSend"
I'm trying to auto login to twitter api with adding a Authorization
header. When i run my code below , i found that the request headers
still not modified with firebug, and the browser pop a window to input
username and password. How can I handle that?
<code>
var url = "http://twitter.com/account/verify_credentials.json?
callback=?";
$.ajax({
beforeSend: function(XMLHttpRequest) {
XMLHttpRequest.setRequestHeader("Authorization", "Basic
eWlzdWRvbmdAZ21haWwuY29tOmV2YTBldwEs");
},
type: "GET",
url: url,
dataType: "jsonp",
success: function(data){
alert( "Data Saved: " + data["friends_count"] );
}
});
</code>