0
var pid = $('#byId').val();

jQuery("#patient").jqGrid({
    mtype: 'GET',
    url : "totalPatientList.html",
    postData :{pid:pid},
    datatype : "json",
    colNames : [ 'Patient Id', 'Name', 'BirthDate', 'Address','City','Mobile' ],
    colModel : [ {
        name : 'patientId',
        index : 'patientId',
        width : 55
    }, {
        name : 'name',
        index : 'name',
        width : 200
    }, {
        name : 'birthdate',
        index : 'birthdate',
        width : 100,
        editable : true
    }, {
        name : 'address',
        index : 'address',
        editable : true,
        width : 80
    }, {
        name : 'city',
        index : 'city',
        editable : true,
        width : 80
    }, {
        name : 'mobile',
        index : 'mobile',
        editable : true,
        width : 80
    } ],
    rowNum : 10,
    rowList : [ 5, 10, 30 ],
    pager : '#pager',
    sortname : 'id',
    viewrecords : true,
    sortorder : "desc",
    caption : "Search Patient's List",
    width : 800,
    cellEdit : true,
});

I have a code like above.

I want to send pid from this JSP page to controller.I am getting pid , but when I reload my web page. I want it without reloading the page when i click the button.

How can I do that?

plz plz help me....

Oleg
  • 220,925
  • 34
  • 403
  • 798
Balkrushn
  • 91
  • 1
  • 1
  • 12

1 Answers1

0

You should use the "function" style of postData:

url: "totalPatientList.html",
postData: {
    pid: function () {
        return $('#byId').val();
    }
}

In the case the value for the pid parameter will be new evaluated on every request to the server. See the answer for more details. In the way you can send multiple parameters to the server by including multiple methods in postData object.

Community
  • 1
  • 1
Oleg
  • 220,925
  • 34
  • 403
  • 798