×

Discussion Board

Results 1 to 8 of 8

Hybrid View

  1. #1
    Registered User
    Join Date
    Apr 2012
    Posts
    11

    JSONP in web apps

    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.

  2. #2
    Registered User
    Join Date
    Sep 2008
    Location
    Manaus, Brazil
    Posts
    109

    Re: JSONP in web apps

    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

  3. #3
    Registered User
    Join Date
    Apr 2012
    Posts
    11

    Re: JSONP in web apps

    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 ...

  4. #4
    Registered User
    Join Date
    Sep 2008
    Location
    Manaus, Brazil
    Posts
    109

    Re: JSONP in web apps

    So, when you use your xhr request the callback is not fired? Can you show your code here?
    Javier Zambrano Ferreira

  5. #5
    Registered User
    Join Date
    Mar 2013
    Posts
    2

    Re: JSONP in web apps

    Hello sdfanq,

    can you share with you the jquery method you used?

    would really appreciate the help

    thanks

  6. #6
    Registered User
    Join Date
    Apr 2012
    Posts
    11

    Re: JSONP in web apps

    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);

  7. #7
    Registered User
    Join Date
    Sep 2008
    Location
    Manaus, Brazil
    Posts
    109

    Re: JSONP in web apps

    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

  8. #8
    Registered User
    Join Date
    Mar 2013
    Posts
    2

    Exclamation Re: JSONP in web apps

    Quote Originally Posted by jzferreira View Post
    Hi sdfanq,

    Sorry, but I didn´t see jsonp in this request. It´s a simple json request. Which parameter is the callback function?
    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&region=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]);
    	}
    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?

Similar Threads

  1. Hub / home-screen apps for third party apps
    By arifzub in forum Windows Phone General
    Replies: 2
    Last Post: 2011-06-22, 12:34
  2. Replies: 9
    Last Post: 2011-05-15, 22:10
  3. to develop Symbian apps(j2me client and j2ee server apps)
    By harish_goel in forum Mobile Java Tools & SDKs
    Replies: 1
    Last Post: 2010-07-29, 10:09
  4. JSONP woes w/S60 3.1 WebKit
    By ...Max... in forum Browsing and Mark-ups
    Replies: 1
    Last Post: 2008-10-02, 17:23
  5. Replies: 0
    Last Post: 2003-02-20, 04:46

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×