larole
larole

Reputation: 172

How do i pass an extra parameter to server using jqgrid and http method POST?

I'm doing something like the guy in this post: is there a way to programatically set a filter in jquery jqgrid?

I'm using http method POST to to get data from my MVC2 project and i saw that you can add a parameter using GET doing like this:

You can modify the url that jqGrid calls, and add the filter option to the querystring, then handle it on the server side.

    $(link).click(function(){

    $(".mygrid").jqGrid('setGridParam',{url:"server.php?useMyFilter=1"})
    });

How can i add a extra filter parameter using POST?

Upvotes: 4

Views: 2708

Answers (1)

Craig Stuntz
Craig Stuntz

Reputation: 126547

For both GET and POST you can set postData:

$(".mygrid").jqGrid('setGridParam',
{
     url:"server.php",
     postData: {
         useMyFilter: 1
     }
});

Note that your call to jqGrid() is missing a ;

Upvotes: 5

Related Questions