Forum


21:34

02/03/2011

I can't seem to get the json data to load in the grid. Here's my html
<html>
<head>
<title>AMAC Remedy</title>
<link type="text/css" href="static/styles/jquery.ui.all.css" rel="stylesheet">
<link type="text/css" href="static/styles/ui.jqgrid.css" rel="stylesheet">
<link type="text/css" href="static/styles/main.css" rel="stylesheet">
<script type="text/javascript" src="static/scripts/jquery-1.5.2.min.js"></script>
<script type="text/javascript" src="static/scripts/jquery.jqGrid.min.js"></script>
<script type="text/javascript" src="static/scripts/json2.js"></script>
</head>
<body>
<div id="af-logo"><img src="static/images/af-logo.png" /> <img src="static/images/afwa-logo.png" /></div>
<div id="header"><span class="title">AMAC Remedy</span><br /></div>
<div class="clear"></div>
<div id="contentMargin" >
<div id="content" >
<table id="jsonmap"></table>
<div id="pjmap"></div>
</div>
</div>
<div id="ajaxMessage"></div>
</body>
<script type="text/javascript">
$(document).ready( function () {
// alert('got here 1');
jQuery("#jsonmap").jqGrid({
url:'locations',
datatype: "json",
colNames:['Location Key','Location Name', 'Latitude', 'Longitude','Location Alias'],
colModel:[
{name:'locationKey',index:'locationKey', width:80},
{name:'locationName',index:'locationName', width:150},
{name:'latitude',index:'latitude', width:100},
{name:'longitude',index:'longitude', width:100},
{name:'locationAlias',index:'locationAlias', width:295, sortable:false}
],
rowNum:25,
// rowList:[10,20,30],
pager: '#pjmap',
sortname: 'locationKey',
viewrecords: true,
sortorder: "asc",
caption: "JSON Mapping",
width: 1040,
height: 600
});
});
</script>
</html>
Here's the json string:
{total: 1, page: 1, records: 3, rows: [{locationKey:1,locationName:"Adelphi",latitude:39.03,longitude:-76.96,locationAlias:""}, {locationKey:2,locationName:"Aiken",latitude:33.57,longitude:-81.73,locationAlias:""}, {locationKey:3,locationName:"Al Asad Airfield",latitude:33.79,longitude:42.44,locationAlias:"QadisiyahAirbase, FOB Webster, Objective Weber, FOB Al Asad, Camp Al Asad, Navea Training Center"}]}
Does anyone have an idea as to what I am doing wrong?
01:14

04/01/2010

Hello
I think your problem is in json, it must be valid
you can validate your string in http://jsonlint.com/
Leandro Irgang
Most Users Ever Online: 715
Currently Online:
47 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66