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,
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
Last edited by sdfanq; 2012-05-04 at 18:01.
Hi sdfanq,
Yes, you can use. Do you have any problem to use JSONP in your web apps? Can you show the error?
Javier Zambrano Ferreira
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?
Javier Zambrano Ferreira
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);
Hi sdfanq,
Sorry, but I didn´t see jsonp in this request. It´s a simple json request. Which parameter is the callback function?
Javier Zambrano Ferreira
Hello jzferreria,
Here is the simple jsonp request with the callback
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?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]); }
Hello sdfanq,
can you share with you the jquery method you used?
would really appreciate the help
thanks