Passing parameters to url

Passing parameters to url

Hi, I am new to javascript and jquery but found it very useful for what I am trying to do. I found a sample code online, which uses jqGrid with local data: http://jsfiddle.net/hE2GB/. I have added a line "url: 'api/editSelection'" similar to the example code below to editsettings {} on line 114.

My question is: How do I pass dynamic parameters to a url i.e. within the function below instead of zipcode = 97201, I'd want to use an array element zipcode = grid[0].p.selrow?

   
$.ajax({
url: "/api/getWeather",
data: {
zipcode: 97201
},
success: function( data ) {
$( "#weather-temp" ).html( "<strong>" + data + "</strong> degrees" );
}
});

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