how to set headers in jquery ajax call? -


i using web service rest, requires 2 headers finicity-app-key , content-type. in site's example partner authentication, use curl , sends 2 headers. when try set in jquery, if check network tab in dev tools, don't see 2 headers on ajax made. seem show under access-control-request-headers content-type,finicity-app-key.

does know what's wrong?

thanks

https://developer.finicity.com/admin/docs

            $.ajax({                 type: "post",                 url: "https://api.finicity.com/aggregation/v2/partners/authentication",                 datatype: "xml",                 contenttype: "application/xml",                 data : '<credentials><partnerid>24455d81430647</partnerid><partnersecret>v09tauzbygsfknbtfogn0</partnersecret></credentials>',                 beforesend: function (xhr) {                     xhr.setrequestheader('finicity-app-key', 'a0874b0eda76ae7918c779f8eeef92c1a');                     xhr.setrequestheader('content-type', 'application/xml');                 },                 success: function(response){                     alert(response);                 },                 error: function(xhr,status,error){                     alert("error:" + json.stringify(xhr));                 }             }); 

try this

$.ajax({     url: 'your url',     headers: { 'finicity-app-key': 'a0874b0eda76ae7918c779f8eeef92c1a' } }); 

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -