【发布时间】:2015-03-15 16:35:19
【问题描述】:
如果一个网站给出json数组数据如下
mycallback([{"id":"2","name":"Kelly","age":"12"},{"id":"3","name":"Robby","age":"12"}])
我如何将此json 数组数据称为表格
我的尝试,但没有奏效!
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#example').dataTable( {
"processing": true,
"serverSide": true,
"ajax": {
"url": "http://WebSite_URL.com/data.php",
"dataType": "jsonp",
"jsonp":"mycallback"
}
} );
} );
</script>
<table id="example" cellspacing="0" width="100%">
<tr>
<th>ID</th>
<th>Name</th>
<th>Age</th>
</tr>
</table>
【问题讨论】:
-
任何答案都解决了您的问题吗?
标签: javascript jquery json jsonp