0

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.');
  }
});
sideshowbarker
  • 81,827
  • 26
  • 193
  • 197
karthikraja
  • 457
  • 1
  • 5
  • 8
  • See [this specific answer](https://stackoverflow.com/a/14632891/519413) in the duplicate – Rory McCrossan Jan 31 '19 at 10:56
  • look [what](https://stackoverflow.com/questions/14567776/using-jquerys-ajax-function-with-an-ssl-client-certificate) I found after 0.36 seconds of googling! Easy as pie! – vasily.sib Jan 31 '19 at 10:59

0 Answers0