I have hosted a server using SSL, let say https://example.com
, which needs a mandatory client certificate. This means during the client request, the request should have a certificate.
I am calling the URL from AJAX post as below but I am getting an error since I am not passing the certificate. Is it possible to attach a local certificate during the AJAX call?
$.ajax({
url: https: //example.com/TestMethod,
type: 'Post',
datatype: 'json',
headers: {
"TestHeader": "first value"
},
//xhrFields: {
// withCredentials: true
//},
success: function(data, status, xhr) {
$("#txtresponse").val(xhr.responseText);
alert("Request Success", data);
},
error: function(responseData, textStatus, errorThrown) {
alert('Request failed.');
}
});