Welcome!

Welcome to the Official BlackBerry Support Community Forums. This is your resource to discuss support topics with your peers, and learn from each other. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

BlackBerry WebWorks Contributions

Reply
Contributor
praveen3184
Posts: 13
Registered: ‎08-09-2011
Accepted Solution

AJAX request with headers using phonegap

[ Edited ]

Hi,

 

I am developing a BlackBerry Webworks project with phonegap support, i was trying to post ajax request with headers in my code. Some how i was not able to send the request with the header information. I have read some post and added the url in config.xml <access subdomains="true" uri="http://mydomain.com/" /> but still no hope.

 

Below is my code for sending headers:

 

var request = new XMLHttpRequest();
request.open('GET', url, true);
request.setRequestHeader('Content-Type', 'application/json; charset=utf-8');
request.setRequestHeader('Authorization',localStorage.getItem('authorizationToken'));
request.send();

 

Am not sure what am missing. Hope you guys will help me out in this issue.

 

Regards

Praveen Kumar P

Please use plain text.
Contributor
praveen3184
Posts: 13
Registered: ‎08-09-2011

Re: AJAX request with headers using phonegap

Hi,

 

It seems that Authorization keyword has some issues while we use that in the RequestHeader. So i changed the value of the Header Name and it worked.

 

Still am not sure why the Authorization header name didnt work in RequestHeader

Please use plain text.