Con't get the Rest Post response in Jquery Ajax post call.

Con't get the Rest Post response in Jquery Ajax post call.

Hi jquery team,

I am calling the Rest call using the Ajax post method but i get the below error or response.
  1. {"readyState":0,"status":0,"statusText":"error"}

Even i enable the cors($.support.cors = true; ) and crossDomain (crossDomain: true (add in headers)).


Here is the sample request

  1. function() {
            $.support.cors = true;
            var everData = {
            "UpdateContactRequestMessage":{
             "channelPartnerID":"123456",
           "email":"greg@gmail.com",
           "firstName":"greg",
           "lastName":"chappel",
           "externalId":"GC123",
           "sessionToken":"f53095854bb230996f54fe32ed5a63f68c7718c7"
            }
          };

          jQuery.ajax({
            type: 'POST',
            url: '(here is the url) ',
            contentType: "application/json",
            Accept: "application/json; charset=utf-8",
            dataType: 'json',
            data: JSON.stringify(everData),
            async:true,
            crossDomain: true,
            processData: true,
             success: function(resp){ 
                 // we have the response 
                 alert("Server said123:\n '" + resp + "'"); 
               }, 
               error: function(e){ 
                 console.log('tables: ' + JSON.stringify(e));
               }
          });
        };

But i tested this Restapi call in the 'postman' google chrome extension i got the response(successfully got the response).

Here is the response headers

  1. access-control-allow-headers → client_type, content-type, accept, accept-language, auth_token_base64, appID, accept-encoding, content-length, x-requested-with

    access-control-allow-methods → POST, GET, OPTIONS, DELETE

    access-control-allow-origin → *

    allow → GET, HEAD, POST, PUT, DELETE, TRACE, OPTIONS

    content-length → 92

    content-type → application/json

    x-frame-options → sameorigin

    x-webobjects-loadaverage → 0

Anyone help me why i didn't get response from rest api call in JqueryAjax post calls.