1

在我的应用程序中,我在调用 web 服务时从我的服务器获得了 XML 响应。响应如下所示:

<?xml version="1.0" encoding="UTF-8"?>
<string xmlns="http://tempuri.org/">{"rows":[{"noteId" : "1", "procedure" : "D0140", "teeth": "", "encounterno": "123456" , "WorkflowCode": "Submitted", "datecreated": "10/27/2011", "surf": "", "description": "Limited Oral Evaluation-Problem Focused","status": "Existing","prefdate": "10/27/2011 05:06" }, {"noteId" : "2", "procedure" : "D0140", "teeth": "", "encounterno": "123456" , "WorkflowCode": "Submitted", "datecreated": "11/07/2011", "surf": "", "description": "Limited Oral Evaluation-Problem Focused","status": "Completed","prefdate": "01/01/2011 05:08" },{"noteId" : "3", "procedure" : "D0140", "teeth": "", "encounterno": "123456" , "WorkflowCode": "Submitted", "datecreated": "04/01/2011", "surf": "", "description": "Limited Oral Evaluation-Problem Focused","status": "Completed","prefdate": "02/01/2011 05:08" },{"noteId" : "4", "procedure" : "D0140", "teeth": "", "encounterno": "123456" , "WorkflowCode": "Submitted", "datecreated": "01/10/2011", "surf": "", "description": "Limited Oral Evaluation-Problem Focused","status": "Completed","prefdate": "01/01/2011 05:08" },{"noteId" : "5", "procedure" : "D0140", "teeth": "", "encounterno": "123456" , "WorkflowCode": "Submitted", "datecreated": "01/27/2011", "surf": "", "description": "Limited Oral Evaluation-Problem Focused","status": "Completed","prefdate": "10/05/2011 05:08" }]}</string>

我想使用 jQuery Mobile 解析这个字符串,内容将显示在 jQuery Mobile 列表视图中。

如何解析此响应?

4

1 回答 1

0

我想这就是你要找的

http://api.jquery.com/jQuery.parseXML/

一旦你有了解析的对象,你就可以创建一个列表(ul 或 ol)。

然后打电话

$(listItem).listview('刷新')

每次添加列表项元素时。

希望这可以帮助。

于 2012-10-05T13:13:07.637 回答