I am expecting to receive JSON response from the server after authentication has been successful from the RESTful service.
I am using the code below:
jQuery.ajax({
type: "GET",
url: "http://dev.ragld.com/hostinfo/",
contentType: "json",
beforeSend: function(jqXHR){
jqXHR.setRequestHeader("Authorization", "Basic cmsdfsdfG~~~~~Q6cmFnbGQ=");
//some characters have been changed for security reasons.
},
accept: "application/json",
async:false,
success: function(response){
console.log('success called..');
},
error: function(errorObj){
console.log(errorObj);
}
});
For some reasons it isn't selecting method as GET
, When I check NET tab of firebug
in FF it shows method as OPTIONS
instead of GET
.
Similarly, it doesn't return JSON data I am expecting.
any one who can help?
EDIT
Error from chrome, it doesn't say much though: