Android moble jquery JSON, incorrect append element format

Source: Internet
Author: User
Tags php json

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!

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.