ykuramochi / jquery-jsonp

Automatically exported from code.google.com/p/jquery-jsonp
0 stars 0 forks source link

Problem with fixed callback server response #35

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hi,
I'm trying to use the jquery-jsonp plugin to get some json from a server but 
I'm having an issue.
The issue is that the json I get from the server has a fixed callback function 
that can't be set using the callback parameter. To solve this I used the 
solution provided in the trucks an tips, and it worked fine but for one detail. 
The server json is actually special, and looks like this:
elections_jsonp_response('aggregated-places',[<here goes some json>]);
So as you can see, the json response contains a string, and then some other 
json. The problem I'm having is that in the callback method I use once the json 
data is received, I only receive the first string as data, and have no way to 
access the second json data. In the example code below:
$.jsonp({
        url: url,
        callback: 'elections_jsonp_response',
        success: function(data) { console.log(data); alert('ok'); },
        error: function() { 
           alert('ko'); 
        }
    });
I'll get 'aggregated-places' as data, and what I need is the other data.
Is there any way I can get around this problem?

Cheers!

Original issue reported on code.google.com by brafa...@gmail.com on 24 Mar 2011 at 1:49

GoogleCodeExporter commented 8 years ago
Sadly, this is not a properly formed JSONP response and the plugin does only 
support callback( oneParameter ) responses.

Original comment by jul...@creative-area.net on 24 Mar 2011 at 5:45

GoogleCodeExporter commented 8 years ago

Original comment by jul...@creative-area.net on 21 Jul 2011 at 4:10