Ajax call confluence search rest API?

hello, 

I'm trying to call confluence search API with ajax from outside the environment, but get below error, when i click on the search(1,11), i can get the expected result, please advise. 

+++++++++++  ERROR ++++++++++++++++++++++++++

SCRIPT1004: Expected ';'

search(1,11)

{"description":"jCallback was not called","stack":"Error: jCallback was not called...

+++++++++++ CODE +++++++++++++++++++++++++++

function jCallback(json){
    console.log(json);
}

 

var wikiAPI = "https://xx.xx/confluence/rest/searchv3/1.0/search?queryString=global&pageSize=10&os_authType=basic";

$.ajax({
    url:wikiAPI,
    type:"GET",
    contentType:'application/jsonp',
    dataType:"jsonp",
    crossDomain:true,
    beforeSend: function(xhr) { xhr.setRequestHeader("Authorization", "Basic " + btoa(username + ":" + password)); },
    jsonpCallback:'jCallback',
    error: function(xhr,status,error) {
        console.log(JSON.stringify(error));
    },
    success: function(response){
        console.log(response);
   }
});

1 answer

Hi,

you should try asking this question to the developer community. I'm pretty sure you'll find some help there.

https://developer.atlassian.com/community/

Suggest an answer

Log in or Sign up to answer
Community showcase
Published 13 hours ago in Jira Ops

Jira Ops Early Access Program Update #1: Announcing our next feature and a new integration

Thanks for signing up for Jira Ops! I’m Matt Ryall, leader for the Jira Ops product team at Atlassian. Since this is a brand new product, we’ll be delivering improvements quickly and sharing updates...

164 views 0 5
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