Service side: PHP
Client: Andorid, HTML5, JQuery, Ajax
Phenomenon: This would like to use jquery Ajax function from the server to retrieve the data stored in the phone's cache, the result is always wrong, and later thought may be a cross-domain problem, so check the next JSONP of the program first to run the process, tomorrow to improve to see what good plan
Service side: http://www.code-style.com/test/a.php
<? PHP // The service side returns JSON data $arr=array(' name ' = ' shujun.li '); $result=json_encode ($arr); // Dynamic Execution callback function $callback=$_get[' Callback ']; Echo $callback. " ($result) ";? >
Client
<!DOCTYPE HTML><HTML><Head> <MetaCharSet= "Utf-8"> <title>Listview autodividersselector-jquery Mobile Demos</title> <Scriptsrc= "Js/jquery.js"></Script> <Scripttype= "Text/javascript">$.ajax ({URL:"http://www.code-style.com/test/a.php", DataType:'Jsonp', Data:"', Jsonp:'Callback', Success:function(Result) {alert (result["name"])}, timeout: the });</Script></Head><Body></Body></HTML>
Generate url:http://www.code-style.com/test/a.php?callback=jquery1102004144126083701849_1420635061128&_= 1420635061129
Response: jquery1102004144126083701849_1420635061128 ({"Name": "Shujun.li"})
WebApp Development: Ajax requests resolution of cross-domain issues