Hi,
I have a RestFul service, which provides several interfaces for different functionalities. I want to send a request envelop (e.g. uid and password for Authentication) and process the response.
I am trying using jQuery, Ajax but when I sent a https request then it gives me the following respose.
{"readyState":0,"responseText":"","status":0,"statusText":"error"}
Here is my code sample.
url: "https://mysite/login",
type: "POST",
data: {
"uid": uname,
"password": pswd
},
dataType: 'json',
contentType: 'application/json',
headers: { 'My-Key': 'ABCMDJDFJFDFKDFEKEKRKR39; },
/* beforeSend: function(xhr) {
xhr.setRequestHeader('My-Key', 'ABCMDJDFJFDFKDFEKEKRKR3');
},*/
async: true,
crossDomain: true,
success:function () {
// data: JSON.stringify(data);
var obj=jQuery.parseJSON(data);
// alert("success");
console.log(data);
alert(JSON.stringify(data)+" Success");
//JSON.parse(t);
},
error:function(data){
// data: JSON.stringify(data);
//var obj1=jQuery.parseJSON(JSON.stringify(data));
//var x= JSON.parse("two"+data);
console.log(data);
//alert(resp.responseText);
alert(JSON.stringify(data)+" error");
}
I tried using "beforeSend" function but the result is same.
I found out that I need to send certificate or key-store details to the server then it will give me proper response. Please let me know what are the ways that I can send these details. I know it is not possible using jQuery, Ajax. So what are the other alternatives that I can go for?
Regds