How can I make a call to REST API using JQuery, Cross domain to get the list of issues in Jira?

I'm developing a SharePoint2013 application in which I can only use Client Scripts (such as JQuery). I have to show list of JIRA issues assigned to the current logged on user. The app is deployed to a different hos than SharePoint so, I need to make a cross domain script call (JSONP). I have tried a lot of different things including the one below and non of them has worked. Please let me know what should I do to make this call?

BTW, I have tried the parameters used for $.ajax({}) in curl and it's returning expected response. it's just the usage of jsonp (perhaps) that is not right in my code (below):

Thanks in advance

'#ajax').click(function () {
"Content-Type": "application/json",
function (data) {
"hello there!");
function () {
function (xhr) {
"Authorization", "Basic a2F0aWVqOnBhc3NAd29yZDE=");

5 answers

Hello Everyone !!!,

I am facing issue in JIRA rest call using jquery in my web application . Below is the sample code that i have used.  Below sample code giving following error 

Refused to execute script from '' because its MIME type ('application/json') is not executable, and strict MIME type checking is enabled.


            url: '',
            dataType: 'jsonp',
            jsonp: 'jsonpcallback',
            beforeSend: function (xhr) {
                    xhr.setRequestHeader("Authorization", "Basic username:password in encode form);
        function jsonpcallback(data) {
            alert('inside jsonpcallback');

I think you have stumbled on the known limitation of JSONP - it does not handle 401 errors.

You can read about it here:

There are several ways of resolving it. One of them is using timeout:

You can successfully login by making a GET request to the URL ''
Since this is cross domain request you need to handle it using JSONP but the server returns only JSON data which leads to another error:
SyntaxError: invalid label in Mozilla.
Uncaught SyntaxError: Unexpected token : in Chrome
type: 'GET',
url: '',
contentType: "application/jsonp",
crossDomain: true,
dataType: 'jsonp',
jsonpCallback: 'jsonpCallback',
success: function (response) {
alert('success--' + response);
error: function (response) {

Please let me know if you get any solution to this.
Thanks in Advance.

Make sure your dataType is 'jsonp' and jsonp param is 'jsonp-callback'. This works with version two api (https://[yourSubDomain]

url: 'https://[yourSubDomain][yourRequest],
dataType: 'jsonp',
jsonp: 'jsonp-callback'

I tried this way..

var data= {

"username": "myusername",

"password": "mypassword"




type: POST,

dataType: 'jsonp',

jsonp: 'jsonp-callback',

data: data,

crossDomain: true,

success: function (data) { alert('success!' + data); },

error: function (data) { alert("error!!" + data); }


Now i get 404 not found error. in version 2
But Version 1 was returning 415 unsupported media type.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Jan 08, 2019 in Jira

How to Jira for designers

I’m a designer on the Jira team. For a long time, I’ve fielded questions from other designers about how they should be using Jira Software with their design team. I’ve also heard feedback from other ...

1,137 views 4 9
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you