Hi,
Is there any way I could implement JSONP in my S40 web app ? I'm using an API that doesn't support cross domain requests.
Best regards,
Stefan
Printable View
Hi,
Is there any way I could implement JSONP in my S40 web app ? I'm using an API that doesn't support cross domain requests.
Best regards,
Stefan
Hi sdfanq,
Yes, you can use. Do you have any problem to use JSONP in your web apps? Can you show the error?
Thank you for the support, I don't know what the problem was but it worked using jQuery.
Using synchronous xhr (and with no library) I was always getting empty messages in the console, and they were coming instantly as though I was making asynchronous calls ...
So, when you use your xhr request the callback is not fired? Can you show your code here?
It was something like this:
[CODE]
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function(){
if(xhr.readyState == 4){
loadingEvents = false;
if(xhr.status == 200){
console.log(xhr.responseText);
}
}
}
var queryString = 'http://api.eventful.com/json/events/search' + '?app_key=' + eventful.app_key + '&date=' + eventful.date + '&location=' + latitude + ',' + longitude + '&within=' + eventful.within + '&page_size=' + eventful.page_size;
xhr.open('GET', queryString, true);
xhr.send(null);
[/CODE]
Hi sdfanq,
Sorry, but I didn´t see jsonp in this request. It´s a simple json request. Which parameter is the callback function?
[QUOTE=jzferreira;893143]Hi sdfanq,
Sorry, but I didn´t see jsonp in this request. It´s a simple json request. Which parameter is the callback function?[/QUOTE]
Hello jzferreria,
Here is the simple jsonp request with the callback
[CODE]function jsonp() {
var sc = document.createElement('script');
sc.type = "text/javascript";
var url = "http://answers.yahooapis.com/AnswersService/V1/questionSearch?query=maybelline®ion=in&appid=dj0yJmk9aVE5cFRyb2VHeVFvJmQ9WVdrOVJWTTBVSE5PTlRRbWNHbzlPVE14TXpnMk5qWXkmcz1jb25zdW1lcnNlY3JldCZ4PTll&output=jsonp&callback=call_back";
sc.src = url;
console.log("reached");
}
function call_back(data) {
console.log("called");
console.log(data.all.questions[0]);
}[/CODE]
when i see in the console, i can see the jsonp() method's reached, but not call_back's console output "called" am i doing something wrong here?
Hello sdfanq,
can you share with you the jquery method you used?
would really appreciate the help
thanks