【发布时间】:2016-10-16 17:07:43
【问题描述】:
$.ajax({
url: 'https://offcloud.com/api/cloud/status',
data: {'requestId' : 'theid'},
type: 'POST',
crossDomain: true, // enable this
xhrFields: {
withCredentials: true
},
success: function(data) {
var stringData =JSON.stringify(data);
el.innerHTML = "<pre lang='xml'>" + stringData + "</pre>";
console.log(data);
},
error: function() { console.log('Failed!'); }
});
这是显示的内容:
{"data":[{"accountId":"5xxx","remoteOptionId":"yyyyyy","type":"gdrive","username":"email@gmail.com"}]}
但是,我希望它以 XML 格式正确显示。或任何实际可读的格式,表格,(最好是表格)。有什么简单的方法可以做到这一点?
【问题讨论】:
-
使用 jQuery 数据表。