Answers for "load page with ajax set headers"

2

ajax add header

$.ajax({
  type: "POST",
  beforeSend: function(request) {
    request.setRequestHeader("Authority", authorizationToken);
  },
  url: "entities",
  data: "json=" + escape(JSON.stringify(createRequestObject)),
  processData: false,
  success: function(msg) {
    $("#results").append("The result =" + StringifyPretty(msg));
  }
});
Posted by: Guest on December-15-2020
-1

javascript access ajax response headers

// Remember to add JQuery to your html head!

var xhr = $.ajax({
    url: 'someurl',
    complete: function(data) {
        // Access your response headers by using return value
      	xhr.getResponseHeader("date"); // Specify here the type of header
    }
});
Posted by: Guest on July-04-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language