Click here to Skip to main content
11,484,162 members (70,668 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: JSONP
Guys i am trying to hit this webservice which returns me a json response
 
{"message":"ok","client_transaction_id":"2","transaction_token":"e52126c2b0570335ab33ce3a233c18aea90c7987","status":"1","img":"http://www.zipdial.com/zip2auth/images/access/e52126c2b0570335ab33ce3a233c18aea90c7987"}
 
Now obviously i need it in a variable and need to make a cross domain call using jsonp but i get an  "Uncaught SyntaxError: Unexpected token : " in chrome and "invalid label" in firefox .
Following are the calls that i have tried 
a)   <pre lang="Javascript"> $.ajax({
      type: 'GET',
      url: Url,
      contentType: "application/json",
      crossDomain: true,
      data: {"customerToken": "31f65a57b1d6106c067bc00a51f9128f4db95d1d",   "clientTransactionId": "2", "callerid": "9968280904", duration: "180", "countryCode": "91", "z2vToken": "884acdd6f4293432e922d1d4b4566a3c9f1203c1"},
            dataType: 'jsonp',
            success: function() { console.log('Success!'); },
			error: function() { console.log('Uh Oh!'); },
			jsonp: 'jsonp'
        });
i get uh oh as the answer
b)
jQuery.getJSON(urlFromApi+"&callback=?",function(data) {
    alert(data);
});
The call used above with yahoo's open apis makes it work like a charm but when used with the webservice i actually need to use gives me the same error as above.
So is possible that webservice(third party api on which i have no use) dos not support jsonp ?
Posted 29-Oct-12 20:49pm

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 170
1 Frankie-C 155
2 Raje_ 155
3 OriginalGriff 147
4 CPallini 110
0 Sergey Alexandrovich Kryukov 8,484
1 OriginalGriff 7,948
2 Sascha Lefèvre 3,189
3 Maciej Los 2,601
4 Richard Deeming 2,370


Advertise | Privacy | Mobile
Web03 | 2.8.150520.1 | Last Updated 30 Oct 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100