function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
MktdevMktdev 

AJAX Custom Header

Unable to set custom header on AJAX call. On Send the Headers are added to Access-Control-Request-Headers:x-liveagent-affinity, x-liveagent-api-version rather actual Header.
 
$.ajax({
     url:"https://zzzzzzz.salesforceliveagent.com/chat/rest/System/SessionId",
     dataType: 'json', 
     Accept : "text/plain; charset=utf-8",
     type: 'GET',
     contentType: 'application/x-www-form-urlencoded',
      headers: {
      'X-LIVEAGENT-API-VERSION': '30',
      'X-LIVEAGENT-AFFINITY': 'null'
     },
     success:function(json){

         alert("Success");
     },
     error:function(textStatus ){
         console.log(textStatus );
         alert("Error"+textStatus );
     }      
});