My jqGrid function brings no data, which comes from Restful Web Services. First below url shows json data successfully in web browser.
http://localhost:8080/RESTfulTestWeb/rest/services/getJson/aupres
{"user":[
{"id":"aupres","passwd":"aaa","age":45,"name":"father"},
{"id":"hwa5383","passwd":"bbb","age":40,"name":"mother"},
{"id":"julian","passwd":"ccc","age":15,"name":"son"}
]}
But my bugs-full jqGrid brings nothing. These are my codes
<!DOCTYPE html>
<html>
<head>
<meta charset="EUC-KR">
<title>jQuery Test</title>
<link rel="stylesheet" type="text/css" media="screen" href="jquery-ui.css"/>
<link rel="stylesheet" type="text/css" media="screen" href="ui.jqgrid.css"/>
<script type="text/javascript" src="jquery-2.2.0.min.js"></script>
<script type="text/javascript" src="jquery.jqGrid.min.js"></script>
</head>
<body>
<table id="grid"></table>
<div id="pager"></div>
<script type="text/javascript">
$(document).ready(function(){
$("#cl").click(function(){
$Grid = $("#grid");
$Grid.jqGrid({
mtype: "get",
url: "http://localhost:8080/JQueryJsonWeb/rest/services/getJson/aupres",
restful : true,
contentType: "text/json; charset=utf-8",
dataType: "json",
jsonReader : {
root : "user",
id : "id"
},
colNames : [
'id',
'passwd',
'age',
'name'
],
colModel : [
{ name : 'id', width:40, align:'center'},
{ name : 'passwd', width:80, align:'left' },
{ name : 'age', width:80, align:'left' },
{ name : 'name', width:80, align:'right' }
],
pager : '#pager',
rowNum : '10',
multiselect : true,
postData : {
id : 'id',
passwd : 'passwd',
age : 'age',
name : 'name'
},
});
})
});
</script>
<button id="cl">click</button>
</body>
</html>
Actually I have no idea how to contain the json response in Grid.jqGrid function. Where is json responses contained in Grid.jqGrid?