Found this error
Type error in console
parsererror: SyntaxError: Unexpected token < in JSON at position 0 200 OK
Code:
$.ajax({
type: "POST",
url: "PCM/DataToDisplayPCM",
success: function (dataJson) {
//var json = JSON.parse(dataJson);
var json = $.parseJSON(dataJson);
//debugger;
$("#table").jqGrid({
data: json,
datatype: "JSON",
height: 'auto',
rowNum: 10,
rowList: [10, 20, 30],
colModel: [
{ name: 'ProdPriority', label: 'Priority', index: 'ProdPriority', width: 50 },
{ name: 'ProductCode', label: 'Product Code', index: 'ProductCode', width: 80 },
{ name: 'ProductName', label: 'Product Name', index: 'ProductName', width: 200 },
{ name: 'DIV', label: 'Division', index: 'Division', width: 60 },
{ name: 'Category', label: 'Categary', index: 'Category', width: 150 },
{ name: 'SubCategory', label: 'SubCategary', index: 'SubCategory', width: 150 },
{ name: 'Priority_1', label: 'Priority_1', index: 'Priority_1', width: 80 },
{ name: 'Priority1per', label: 'Priority_1%', index: 'Priority1per', width: 80 },
{ name: 'Priority_2', label: 'Priority_2', index: 'Priority_2', width: 80 },
{ name: 'Priority2per', label: 'Priority_2%', index: 'Priority2per', width: 80 },
{ name: 'Priority_3', label: 'Priority_3', index: 'Priority_3', width: 80 },
{ name: 'Priority3per', label: 'Priority_3%', index: 'Priority3per', width: 80 },
],
pager: "#prowed1",
sortname: 'P_CODE',
viewrecords: true,
sortorder: "desc",
});
jQuery("#table").jqGrid('navGrid', "#prowed1", { edit: false, add: false, del: false });
}
});
This is my jquery code .
Requirement : just data from ajax call and use received data in jqgrid
Controller code returns json data in string
error facing :
Type error
Uncaught TypeError: $(...).jqGrid is not a function
and inside grid :
parsererror: SyntaxError: Unexpected token < in JSON at position 0 200 OK
and I keep only one universal jQuery link in layout
yeah error got cleared .
mainly i separated loading jqgrid and ajax call 1)loaded jqgrid with col model 2)just removed datatype while loading grid
3)in ajax sucess :used "datatype: local" and "data: mydata"
$(document).ready(function () {
$.ajax({
type: "POST",
url: "PCM/DataToDisplayPCM",
success: function (dataJson) {
pcmjson = JSON.parse(dataJson);
$("#table").jqGrid().setGridParam({
datatype: 'local',
data: pcmjson
}).trigger('reloadGrid');
}
})