1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
| <script type="text/javascript">
$(document).ready(function(){
jQuery("#list").jqGrid({
url:'example.php',
datatype: 'xml',
mtype: 'GET',
colNames:['Inv No','Title'],
colModel :[
{name:'ItemID', index:'ItemID', width:100},
{name:'Title', index:'Title', width:400}
],
pager: '#pager',
rowNum:10,
rowList:[10,20,30],
sortname: 'invid',
sortorder: 'desc',
viewrecords: true,
caption: 'My first grid'
});
$.ajax({
url: "http://open.api.ebay.com/shopping?callname=FindItems&responseencoding=JSON&appid=__YOUR API KEY HERE__&siteid=0&version=517&QueryKeywords=Rutgers&MaxEntries=50&callback=true",
dataType: "jsonp",
async: false,
jsonp: "_cb_FindItems",
processData: false,
});
});
function _cb_FindItems(array)
{
array = array.Item;
//Load jqGrid
for(var i=0;i<array.length;i++){
jQuery("#list").addRowData(i, array[i]);
}
}
</script> |