title: Trying to understand jqgrid for jquery. How do I change the URL for my AJAX call?
body: <p>I have everything working from the tutorial, replacing it with my data, but it is a hardcoded situation.  For example, in the tutorial, which is what I have working, I have:</p>
  
  <pre><code>jQuery(document).ready(function(){ 
    jQuery("#list").jqGrid({
      url:'http://127.0.0.1/products/index.php/mystuff/test/1/5/productname/desc',
      datatype: 'xml',
      mtype: 'GET',
      colNames:['ProductID','title', 'description','price','tax','notes'],
      colModel :[ 
        {name:'invid', index:'invid', width:55}, 
        {name:'invdate', index:'invdate', width:90}, 
        {name:'amount', index:'amount', width:80, align:'right'}, 
        {name:'tax', index:'tax', width:80, align:'right'}, 
        {name:'total', index:'total', width:80, align:'right'}, 
        {name:'note', index:'note', width:150, sortable:false} ],
      pager: jQuery('#pager'),
      rowNum:10,
      rowList:[10,20,30],
      sortname: 'title',
      sortorder: "desc",
      viewrecords: true,
      imgpath: 'http://127.0.0.1/products/public/themes/basic/images',
      caption: 'Product List'
    }); 
  }); 
  </code></pre>
  
  <p>But the url is hard coded to pull up data.  The tutorial has:</p>
  
  <pre><code>jQuery(document).ready(function(){ 
    jQuery("#list").jqGrid({
      url:'example.php',
      datatype: 'xml',
      mtype: 'GET',
      colNames:['Inv No','Date', 'Amount','Tax','Total','Notes'],
      colModel :[ 
        {name:'invid', index:'invid', width:55}, 
        {name:'invdate', index:'invdate', width:90}, 
        {name:'amount', index:'amount', width:80, align:'right'}, 
        {name:'tax', index:'tax', width:80, align:'right'}, 
        {name:'total', index:'total', width:80, align:'right'}, 
        {name:'note', index:'note', width:150, sortable:false} ],
      pager: jQuery('#pager'),
      rowNum:10,
      rowList:[10,20,30],
      sortname: 'id',
      sortorder: "desc",
      viewrecords: true,
      imgpath: 'themes/basic/images',
      caption: 'My first grid'
    }); 
  }); 
  </code></pre>
  
  <p>Obviously, the data in my querystring will change and I won't always want the same url of: <a href="http://127.0.0.1/products/index.php/mystuff/test/1/5/productname/desc" rel="nofollow noreferrer">http://127.0.0.1/products/index.php/mystuff/test/1/5/productname/desc</a></p>
  
  <p>And, the tutorial with example.php needs querystring variables so it can get the right data, but they never show that part that I can find.  So how do I change the querystring?  How do I send items dynmically?  Also, the pager buttons send stuff like this because of the hardcode url:</p>
  
  <p><a href="http://127.0.0.1/products/index.php/mystuff/test/1/5/productname/desc?page=2&amp;rows=10&amp;sidx=productname&amp;sord=desc&amp;nd=1248988261293&amp;_search=false" rel="nofollow noreferrer">http://127.0.0.1/products/index.php/mystuff/test/1/5/productname/desc?page=2&amp;rows=10&amp;sidx=productname&amp;sord=desc&amp;nd=1248988261293&amp;_search=false</a></p>
  
  <p>How can I just have a url like /test/the right variables?  How can I change the querystring?</p>
  
  <p>Thank you for any help.  I hope it is not too obvious.  I found <a href="http://www.secondpersonplural.ca/jqgriddocs/_2eb0fi5wo.htm" rel="nofollow noreferrer">setGridParam({url:newvalue})</a> but did not understand how to use it.</p>
  
  <p>Here is the <a href="http://www.secondpersonplural.ca/jqgriddocs/index.htm" rel="nofollow noreferrer">documentation</a>.  The tutorial is at the first part, top.</p>
  
  <p>EDIT:  Thanks for the below.  I am trying to see how they use the setGridParam in their tutorial with example.php.  They simply have example.php and I cannot see how they got the querystring variables there from the html page to the example.php page.  setGridParam may be the right way to accomplish this but it is no where in the example so I cannot figure out how they passed the initial querystring variables over.</p>
  
  <p>I know that I can do this:</p>
  
  <pre><code>    function gridSearch()
      {
          $("#list").setGridParam(
              {
  
                    url:"http://127.0.0.1/products/index.php/mystuff/test/1/5/productname/desc",
                  page:1
              }
              ).trigger("reloadGrid");//Reload grid trigger
          return false
      }
  
  &lt;input id="sData" class="EditButton" type="submit" value="Search" onClick="return gridSearch()"/&gt;
  </code></pre>
  
  <p>and that that will reload the grid (I tested it; it works), but how did they send over items in the tutorial in the first place?  What if I do not want a button to reload but just pass in variables for it to initially load?</p>