Answers for "jquery ajax call with headers"

1

pass header in ajax

$.ajax({
    url: "/test",
    headers: {"X-Test-Header": "test-value"}
});
Posted by: Guest on August-17-2020
0

jquery get request with headers

$.ajax({
         url: "http://localhost/myawsomecode/",
         data: { param1: 'anyvalue', param2: 'othervalue' },
         type: "GET",
         beforeSend: function(xhr){xhr.setRequestHeader('X-Test-Header', 'SetHereYourValueForTheHeader');},
         success: function() { alert('Success!'); }
      });
Posted by: Guest on January-14-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language