Click here to Skip to main content
15,878,809 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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)
JavaScript
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

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900