I am using Jquery for the above requirement.
$.ajax({
type: 'GET',
url: 'https://--------------/rest/auth/1/session'',
crossDomain: true,
dataType: 'jsonp',
success: function (response) {
alert('success--' + response);
},
error: function (response) {
alert('oopss!!');
}
});
I am able to see the response in debugger in JSON format but i have to use dateType: jsonp due to cross domain request, else it throws error 415: Unsupported MediaType
So I get the following errors when i run the script:
SyntaxError: invalid label in Mozilla.
Uncaught SyntaxError: Unexpected token : in Chrome
Please help.
Where am i going wrong.?
Thanks in advance.
See the way jsonp is invoked for JIRA here http://jsfiddle.net/rmanalan/rtvF6/
It may help you.
IT shows for GET requests. If i make any POST requests i get 415 unsupported mediatype error. Any suggestions regarding that.?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What's the post header being set? Check your developer tools in Chrome and see the header being sent
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I get the post header :
Content-Type | text/html;charset=utf-8 |
Date | Wed, 30 Jan 2013 13:59:46 GMT |
Server | nginx |
Set-Cookie | JSESSIONID=AEAF6C3853868EB6920629F486A19C8A; Path=/; HttpOnly studio.crowd.tokenkey=""; Domain=.skalable.atlassian.net; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path =/; HttpOnly studio.crowd.tokenkey=qrk1dL4vKHcyOpspelmDDg00; Domain=.xxxxxx.atlassian.net; Path=/; HttpOnly atlassian.xsrf.token=B9V3-S7DT-R7Y6-F32Y|3bfef2a642091fb9bff59acb496616e7fd3b4aab|lin; Path=/ |
Vary | Accept-Encoding |
X-AREQUESTID | 359x10274x1 |
X-ASESSIONID | 197bgpo |
X-AUSERNAME | swaraj |
X-Seraph-LoginReason | OUT, OK |
Is there anything wrong with the header being set?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yeah, it shows ' Content-Type text/html' It should be application/json
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, i am sending it through jsonp, since json wont support cross domain calls.
If i use application/json the post request changes to OPTION.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ah ok. No idea, never used jsonp with JIRA.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.