i have created simple phonegap application using phonegap build. have mysql db , write simple php file read data , give json format. try read info in html file in phonegap application mobile not show anything. can me find problem? add cordova-plugin-inappbrowser plugin in app. here code example used:
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>read json example (ajax)</title> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $.ajax({ type: "get", url: "http://phonegappro.esy.es/test/json.php", crossdomain: true, cache: false, success: function(result){ var result=$.parsejson(result); $.each(result, function(i, field){ $("#output").append("title: "+ field.title + " duration: "+field.duration +" price:"+field.price+"<br/>"); }); } }); }); </script> </head> <body> <div id="output"></div> </body>
i found answer: added phonegap build whitelist plugin , work correctly on android devices also. plugin: <plugin name="com.indigoway.cordova.whitelist.whitelistplugin" spec="1.1.1" source="pgb" />
moreover, in config.xml file, have: <access origin="*"/>
too
Comments
Post a Comment