I'm using a jqGrid to display the results of a search. When the search button is clicked it does this:
$("#Search").jqGrid('setGridParam', { url: url }).trigger("reloadGrid");
Where url
contains the search params, for example:
var url ="/search?first=joe&last=smith"
The web server is receiving this URL and responding appropriately. But on the client side it throws this error in jqgrid.min.js line 21:
Syntax error:
}); b.fn.jqGrid = function(f) {
What can I do to fix this? I'm using jqGrid sucessfully in many other places, but this is the only one where I'm changing the URL and reloading.
Try using the non minified version on this page to see more context of why it's surrounding. What you're seeing there is a where parsing is halting; I suspect your error is further up. This way you can see if the current url is being used and what's throwing it off.
It seems to me that the error which you have in jqgrid.min.js corresponds an error in uncompressed version of jqGrid direct at the beginning of .jqGrid('setGridParam', { url: url })
(see line 82 of grid.base.js). It is the part of the so named "New API" introduced in 3.6 version of jqGrid. The code fragment started with following lines:
$.fn.jqGrid = function( pin ) {
if (typeof pin == 'string') {
var fn = $.fn.jqGrid[pin];
if (!fn) {
throw ("jqGrid - No such method: " + pin);
}
var args = $.makeArray(arguments).slice(1);
return fn.apply(this,args);
}
//...
I am not sure why you have a "syntax error", bu I recommend you to verify, that the id of the grid is really "Search". If you will don't find an error add more information in your question. For example: which version of jQuery you use? Including of a code fragment and the order of JavaScripts which you load would be also helpful.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With