Passing parameters to url

Passing parameters to url

Hi, I am new to javascript and jquery but found the jqgrid plugin very useful for what I am trying to do. I found a sample code online, which uses jqGrid with local data, you can find the complete code here:  http://jsfiddle.net/hE2GB/9/

I have added the two lines for "url" and "editdata" similar to the example code below to editsettings {} on line 114. It seems to be calling the url correctly, but for editdata, i want to pass the selected row as a parameter which doesn't seem to work using the code below.

My question is: How do I pass dynamic parameters to a url i.e. within the function below instead of id = grid[0].p.selrow? It seems that grid[0].p.selrow can only be called if it is within a function e.g. on line 196 in the complete code.

    
  1. editSettings = {
  2. recreateForm:true,
  3. jqModal:false,
  4. reloadAfterSubmit:false,
  5. closeOnEscape:true,
  6. closeAfterEdit:true,
  7. url: 'ajax/editRow',
  8. editdata: {id:grid[0].p.selrow},
  9. onclickSubmit:onclickSubmitLocal
  10. },

I have been googling everywhere but couldn't find an answer to this.
Any help would be appreciated.