Click here to Skip to main content
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 BillWoodruff 330
1 Mathew Soji 309
2 Maciej Los 295
3 DamithSL 225
4 Afzaal Ahmad Zeeshan 217
0 OriginalGriff 6,369
1 Sergey Alexandrovich Kryukov 5,973
2 DamithSL 5,183
3 Manas Bhardwaj 4,673
4 Maciej Los 4,025


Advertise | Privacy | Mobile
Web01 | 2.8.1411019.1 | Last Updated 30 Oct 2012
Copyright © CodeProject, 1999-2014
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