【发布时间】:2015-04-02 12:22:50
【问题描述】:
以下是我的 json 数据 URL http://bluestonesolutions.in/Connect4mJson/GetEmployees.svc/getnotice?InstanceId=604&EnoticeType=Flash%20News&UserID=112730&IsGlobalNotice=0
我想使用 jquery Mobile for Phonegap 在表格中显示数据。我可以轻松获取数据,但可以在移动设备中显示。
这是工作示例。请指导我如何为phonegap解析它
$(document).ready(function() {
$.ajax({
url : 'http://bluestonesolutions.in/Connect4mJson/GetEmployees.svc/getnotice?InstanceId=604&EnoticeType=Flash%20News&UserID=112730&IsGlobalNotice=0',
type : 'GET',
dataType : 'JSON',
crossDomain: true,
success : function(data) {
document.write('<table width="400" height="288" align="center" style="border:5px solid #10A3D8; ">')
$.each(data, function() {
console.log(this.Subject);
document.write('<tr style="background:#D4D2D2;" >')
document.write('<td style="color:#041DB3;">'+'Subject:-</td>')
document.write('<td style="color:#041DB3;">'+this.Subject+'</td>')
document.write('</tr>')
document.write('<tr style="background:#04A273;">')
document.write('<td>'+'Description:-</td>')
document.write('<td>'+this.ENoticeDescription+'</td>')
document.write('</tr>')
});
document.write('<table>');
// open console debugging tools on google and see the parse value
},
error : function() {}
});
});
【问题讨论】:
-
请格式化您的代码。
-
我可以辨认出
document.write('') document.write('') document.write,这到底是什么O_o 这会擦除整个文档。
标签: javascript jquery cordova jquery-mobile phonegap-desktop-app