1

I need add different headers to html page in js, but I don't know how. In php that was easy, but now I write in Java and on html page i have only js to use. Any idea ?

1
  • Do you mean Java or JavaScript by “Java”? If Java, why isn’t Java included in the tags? Commented Feb 18, 2013 at 6:51

3 Answers 3

1

use this:

xhr.setRequestHeader('header', 'value');

butI think the easiest way to accomplish it is to use querystring instead of HTTP headers.

Sign up to request clarification or add additional context in comments.

Comments

0

I need something like include() in php. I need add different html heads depending on url.

Comments

0
jQuery(document).ajaxSend(function(event, xhr, settings) {
     ...

     // xhr is an XMLHttpRequest object
     xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken'));
}

I think your problem can be solved by the above code.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.