As mentioned in the preceding figure, data cannot be obtained at the beginning. The reason is that the android php json communication has already said that this time the format is incorrect. After reading this article, the solution is as follows,
Call the encapsulated refresh method: $ ('# getjson'). listview ("refresh ");
Jqury:
<script> $.getJSON('http://www.myurl.com/json_android/index.php?type=1',function(json){ if(json!=''){ $('#getJson').append('<li><a style="color:#239829" href="http://www.cnblogs.com/docs/lists/index.html">'+json.title+'</a></li>'); } else $('#images').append('<font style="color:red">'+json.title+'</font>'); $('#getJson').listview("refresh"); }); </script>
<Ul data-role = "listview" id = "getjson"> <li data-role = "list-divider"> Shaanxi </LI> <li> <a style =" color: #239829 "href =" http://www.cnblogs.com/docs/lists/index.html "> Xi'an </a> </LI> </ul>
PHP section:
<? PHP
$ Array = array ('title' => 'name', 'value' => 'doooger ');
Echo json_encode ($ array );
?>
Bytes ---------------------------------------------------------------------------------------------------------------------------
In addition, Xie Liangge and Liang suggested to build a website locally and put the webpage files on the website. After local competition, the time needed to debug the simulator or device after each change was shortened, lianggeweiwu!
I used to think about the local server on the Android device. Why didn't I expect to change the android code after the local server is completed? Stupid ~~~~
Close the work!