Get current url including parameters of Jqgrid

I am looking to get the full url of the last request to my ajax service made by JqGridincluding page, records per page, search params etc.

Is there any method or collection of methods within the JqGrid api I can use to achieve this?



jqGrid don't save somewhere the full URL appended with all parameters. So it is not possible within the jqGrid API archive this.

To see full URL you can use Firebug, Fiddler or other close tool.

In general it is well known how the url will constructed. How I understand indirectly you want use HTTP GET (mtype: "GET"). I explain the construction of the URL in case of HTTP GET.

The full URL of the GET requests will constructed from:

  • url parameter of the jqGrid
  • postData parameter of the jqGrid
  • some additional paremeters which depend on the action used (first grid load, data searching, paring and so on). The names of this additional parameters can be changed by prmNames parameter of jqGrid (see For example if you define prmNames: {sort: "searchIndex", order: "searchDirection", search: null, nd: null} then parameters sidx and sord will be renamed to searchIndex and searchDirection. Parameters _search and nd will not send.

Below you find some typical urls:

  1. baseurl?_search=false&nd=1250348761396&rows=20&page=1&sidx=&sord=asc
  2. baseurl?_search=false&nd=1250348761396&rows=20&page=1&sidx=Name&sord=asc
  3. baseurl?_search=true&rows=10&page=1&sidx=Name&sord=asc&searchField=Manufacture &searchString=Micro&searchOper=bw

The first url requests loading of the first page of data, 20 rows per page, no sorting. The second url has sorting by Name. The third url contain data filtering (with simple searching) based on the filter "Manufacture begins with Micro" and sorting by Name. Results are paged by 10 rows per page and the first page are requested.

In case of using Advanced Searching or Toolbar Searching instead of Simple Searching the url will looks like a little other. Everithing are documented unter If you do have additional questions I'll can explain all more detailed.

It is important to understand that parameters used in URL should be encoded. So if you want cunstruct url yourself like

"baseUrl?firstName=" + myFirstName + '&lastName=' + myLastName

you should don't forget to use encodeURIComponent function to encode myFirstName and myLastName. Instead of that you can use jQuery.param (see why my search code does not work on internet explorer) or better use postData parameter of the jqGrid (see jqgrid not updating data on reload and How to filter the jqGrid data NOT using the built in search/filter box. In the last case symbols '?' and '&' will be inserted in the url if it is needed and all data values will be encoded with respect of encodeURIComponent.


I had a similar need and solved it with this:

var myUrl = jQuery("#grid").jqGrid('getGridParam', 'url');
myUrl += "?myextraparam=something";
var postData = jQuery("#grid").jqGrid('getGridParam', 'postData');
$.each(postData, function(key, value) {
  myUrl += "&"+key+"="+encodeURIComponent(value);

For me, the above got all I needed including items from the search toolbar if used. The ?myextraparam=something should be replaced with any extra parameters you want to pass.


Here is the simple answer. JQGrid will append to your query strings.

url: "/CaseManagement/Shipping/GetLastShipments?StudentID=" + GetSelectedStudentID(),


Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.