Popovici Sebi
Popovici Sebi

Reputation: 258

Error when requesting a Jsonp using JIRA REST API

I made this function to request some tickets from JIRA,I gave the data type as jsonp to avoid the Cross origin problem , and when I make the request I get the response in browser debugger , but cannot handle the json response "SyntaxError: missing ; before statement" , is there any way to read json if I send the request for jsonp ?

     var ajaxUrl = jira/rest/api...
     jQuery.ajax({
        url:ajaxUrl,
        dataType: 'jsonp',
        jsonpCallback: 'callback',
        type : "GET",
        beforeSend: function (xhr){
          success: function w(data){
            console.log(data);
            alert('Sucess data: ' + data);
          };
          error: function e(data){alert('alert error');}
        }
    })

Upvotes: 1

Views: 445

Answers (1)

Popovici Sebi
Popovici Sebi

Reputation: 258

I solved the problem , I changed the jsonp in json , and I remade the corss from jira server how it is explained here : https://community.atlassian.com/t5/Answers-Developer-Questions/Enable-CORS-in-JIRA-REST-API/qaq-p/553997 , it looks like the problem was on the preflight part.

Upvotes: 1

Related Questions