I m making ajax call like this :
var username = "someusername";
var password= "somepassword";
var datam = '{"description":"my description","account":"mehame","username":"hakan","password":"11"}';
$.ajax
({
url: "http://mywebsite.com:8080/directory/send",
contentType: "application/json",
data: datam,
dataType: 'text',
type: "PUT",
headers: {
"Authorization": btoa(username + ":" + password)
},
beforeSend: function (){
//xhr.setRequestHeader('Authorization', make_base_auth(username, password));
console.log(datam);
},
success: function (){
alert("Here's lots of data, just a string: " + datam);
},
error : function(){
alert("Here's lots of data, just a string: " + datam);
}
});
});
And firebug console gave me "Cross Domain Error" (and returned error) :
"Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://mywebsite.com:8080/directory/send. This can be fixed by moving the resource to the same domain or enabling CORS."
But in my chrome extensions name is "PostMan" its completely working.
What is different?