title: jqGrid 'url' parameter causes errors in pages in deeper URLs
body: <p>I'm trying to deploy an ASP.NET MVC site to a Windows 2003, IIS 6.0 server with the 3.5 framework installed (but not ASP.NET MVC - it's just in the bin folder). The site makes use of jqGrid, but on the deployment server the grid is failing in certain cases.</p>
  
  <p>The web site's master page is at /Views/Shared/Site.Master. It has a script tag to include the JavaScript to initialize and load a jqGrid. </p>
  
  <p>I found that when I deployed, neither the JavaScript "/" nor the ASP "~" forced the path to the script files to absolute paths. I needed to add some code to ensure the path was complete:</p>
  
  <pre><code>&lt;script type="text/javascript" src=&lt;%= VirtualPathUtility.ToAbsolute("~/Scripts/searchControls.js") %&gt; &gt;&lt;/script&gt;
  </code></pre>
  
  <p>The url in the jqGrid initialize function includes the path to the controller method to get the initial data, like this:</p>
  
  <pre><code>jQuery("#searchResultList").jqGrid({
          url: './Report.mvc/GetResultsL2E/',
          datatype: 'json',
          mtype: 'GET',
          colNames: ['', 'ID', 'Title', 'Post_Date', 'Start_Date', 'End_Date', 'Summary', 'Categories', 'Affected Places'],
      colModel: [
        { name: 'act', index: 'act', width: 75, sortable: false },
        { name: 'ID', index: 'ID', width: 40, align: 'left', hidden: true },
        { name: 'Title', index: 'Title', width: 150, align: 'left' },
        { name: 'Post_Date', index: 'Post_Date', width: 80, align: 'left' }, //, formatter: 'date' },
        { name: 'Start_Date', index: 'Start_Date', width: 80, align: 'left' }, //, formatter: 'date' },
        { name: 'End_Date', index: 'End_Date', width: 80, align: 'left' }, //, formatter: 'date' },
        { name: 'Summary', index: 'Summary', width: 240, align: 'left' },
        { name: 'Categories', index: 'Categories', width: 140, align: 'left' },
        { name: 'Affected Places', index: 'AffectedPlaces', width: 140, align: 'left' }
      ],
      pager: jQuery('#searchResultPager'),
      rowNum: 10,
      rowList: [5, 10, 20, 50],
      sortname: 'Title',
      sortorder: 'asc',
      imgpath: './Scripts/jqGrid/themes/green/images',
      caption: 'Report Search Results',
      editurl: './Report.mvc/Edit/',
      height: 'auto',
      multiselect: true,
      multiboxonly: true, //adds check box column
      viewrecords: true,
      recordtext: ' Reports',
      pgtext: ' of ',
      altRows: true,
      loadComplete: function() {
          var ids = jQuery("#searchResultList").getDataIDs();
          for (var i = 0; i &lt; ids.length; i++) {
              var cl = ids[i];
              be = "&lt;a href='./Report.mvc/Edit/" + cl + "' title='Edit'&gt;&lt;img src='./Content/Images/Icons/Edit.png' border='0' alt='Edit' /&gt;&lt;/a&gt;";
              se = "&lt;a href='./Report.mvc/Details/" + cl + "' title='View'&gt;&lt;img src='./Content/Images/Icons/view.png' border='0' alt='View' /&gt;&lt;/a&gt;";
              ce = "&lt;a href='./Report.mvc/Delete/" + cl + "' title='Delete'&gt;&lt;img src='./Content/Images/Icons/delete.png' border='0' alt='Delete' /&gt;&lt;/a&gt;";
              jQuery("#searchResultList").setRowData(ids[i], { act: be + se + ce })
          }
      }
  }).navGrid('#searchResultPager',
  { edit: false, add: false, del: false, search: false }, //options 
  { height: 280, reloadAfterSubmit: false }, // edit options 
  { height: 280, reloadAfterSubmit: false }, // add options 
  { reloadAfterSubmit: false }, // del options 
  {} // search options 
  );
  </code></pre>
  
  <p>I also found that I had to add the dot to make this work on the IIS 6 server, but it does work.</p>
  
  <p>The problem is that I have links in the 'act' column to navigate to an edit page. The edit page uses the same master page, and therefore the same scripts. However, the URL to the page is /MyWebApp/Report.mvc/Edit/# (where # is the ID of the report to edit). And the jqGrid will not initialize.</p>
  
  <p>In Firebug console I see the error:</p>
  
  <pre><code>jQuery("#searchResultList").jqGrid is not a function
  
             loadComplete: function() {\r\n
  </code></pre>
  
  <p>which I'm pretty sure is bogus, because the only variation I can see is that the URL is now one level deeper (/Report.mvc/Edit vs. /Report.mvc).</p>
  
  <p>There are a number of quirky things on this network and as a contractor I have no control over them, and not much more control over the server. </p>
  
  <p>I'm thinking this is a problem with jqGrid's handling of the URL, because I tried to set the url parameter to the following values:</p>
  
  <pre><code>http://server_name/MyWebApp/Report.mvc/GetResultsL2E/  and
  /MyWebApp/Report.mvc/GetResultsL2E/
  </code></pre>
  
  <p>Both raised script errors on all pages, referring to s.data or s.url not being a function in the jQuery.js script.</p>
  
  <p>Does anyone have any hints on how to make this work in my deployment environment?</p>
  
  <p>UPDATE:
  I long ago worked around this problem, but now i find out that the test server that has had these weird quirks is a virtual server. I'm looking to find out if that has any bearing on this and other issues on this particular network.</p>