How to send headers with ajax request ?

I've been trying to add headers to ajax request through enyo ajax call.But I couldn't find any headers sent with requset when I checked in network tab of chrome console.These are the few lines that I've written.

var req = new enyo.Ajax({
url: "",
// url:"C:/Program Files/Apache Software Foundation/Tomcat 7.0/webapps/json.docx",
method: "GET",
postbody:"hai hello how are you",
headers:{"X-My-Header": "My Value", "Mood": "Happy" }
var res = req.response(this, "handleData").go();

Finally, what I need is to send both pre-defined and custom headers through ajax request.So,can you please help me in doing this!!!!!


  • The enyo.Ajax code looks right, except it should be postBody, not postbody. See if that helps? If not, can you share a screenshot of the Chome debug console where the request headers are displayed?
Sign In or Register to comment.