I am taking the first steps in PhoneGap with Android (why do you need to choose a platform, anyway? This should be cross-platform!). I am trying to call a RESTful service, get JSON in return and put it on the screen. The tutorials for this are incredibly hard to find. I am using the following code:
<!DOCTYPE HTML> <html> <head> <title>JSON Demo</title> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="jquery-1.6.4.js"></script> <script type="text/javascript"> $.getJSON('http://MyServerIP/json/GetJobDetails/717/MyKey?callback=?', { success:function(data) { data = evalJSON(data); $('body').append('<strong>X </strong>'); }, error: function() { $('body').append('<strong>Error </strong>'); } }); </script> </head> <body> test 10 </body> </html>
... But I get no answer, no success, no mistake. The server reports that it was hit, and returned the data. Viewing a single URL also returns data. Why doesn’t anything appear in the emulator?
json android cordova
Stevecav
source share