Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3318322
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T22:41:31+00:00 2026-05-17T22:41:31+00:00

I have a form like this: <form id=’myForm’> <input type=’text’ name=’search’ /> <input type=’text’

  • 0

I have a form like this:

<form id='myForm'>
<input type='text' name='search' />
<input type='text' name='maxPrice' />
</form>

and table for my jqGrid:

<table id='myGrid'></table>

I need to POST (not GET) the data from myForm to my server method in order to fetch the row data and populate the grid. So far, I’ve not been able to get jqGrid to POST anything. I double-checked my data serialization and it is serializing my form data properly. Here is my jqGrid code:

$("#myGrid").jqGrid({
    url: '/Products/Search") %>',
    postData: $("#myForm").serialize(),
    datatype: "json",
    mtype: 'POST',
    colNames: ['Product Name', 'Price', 'Weight'],
    colModel: [
        { name: 'ProductName', index: 'ProductName', width: 100, align: 'left' },
        { name: 'Price', index: 'Price', width: 50, align: 'left' },
        { name: 'Weight', index: 'Weight', width: 50, align: 'left' }
    ],
    rowNum: 20,
    rowList: [10, 20, 30],
    imgpath: gridimgpath,
    height: 'auto',
    width: '700',
    //pager: $('#pager'),
    sortname: 'ProductName',
    viewrecords: true,
    sortorder: "desc",
    caption: "Products",
    ajaxGridOptions: { contentType: "application/json" },
    headertitles: true,
    sortable: true,
    jsonReader: {
        repeatitems: false,
        root: function(obj) { return obj.Items; },
        page: function(obj) { return obj.CurrentPage; },
        total: function(obj) { return obj.TotalPages; },
        records: function(obj) { return obj.ItemCount; },
        id: "ProductId"
    }
});

Can you see what I’m doing wrong or should be doing differently?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T22:41:31+00:00Added an answer on May 17, 2026 at 10:41 pm

    Your main error is the usage of the postData parameter in the form:

    postData: $("#myForm").serialize()
    

    This usage has two problems:

    1. The value $("#myForm").serialize() overwrite all parameters of the POST requests instead of the adding additional parameters.
    2. The value $("#myForm").serialize() will be calculated only once during the grid initialization time. So you will send always search="" and maxPrice="" to the server.

    I suggest you to to replace the form with named edit fields to

    <fieldset>
    <input type='text' id='search' />
    <input type='text' id='maxPrice' />
    <button type='button' id='startSearch'>Search</button>
    </fieldset>
    

    define postData parameter as object with methods:

    postData: {
        search: function() { return $("#search").val(); },
        maxPrice: function() { return $("#maxPrice").val(); },
    },
    

    and add onclick event handler to the “Search” button (see above HTML fragment)

    $("#startSearch").click(function() {
        $("#myGrid").trigger("reloadGrid");
    });
    

    Moreover you write nothing about the server technology which you use. It can be some additional modification is required to be able to read parameters on the server side (for example serializeRowData: function (data) {return JSON.stringify(data);} see this and this). I recommend you also to read another old answer: How to filter the jqGrid data NOT using the built in search/filter box.

    Some other small errors like '/Products/Search") %>' instead of ‘/Products/Search’ or the usage of deprecated parameter imgpath (see documentation) are less important. The default column options like align: 'left' should be better removed.

    Consider also to use searching in the grid. For example advance searching

    $("#myGrid").jqGrid('navGrid','#pager',
                        {add:false,edit:false,del:false,search:true,refresh:true},
                        {},{},{},{multipleSearch:true});
    

    and also toolbar searching:

    $("#myGrid").jqGrid('filterToolbar',
                        {stringResult:true,searchOnEnter:true,defaultSearch:"cn"});
    

    it can probably replace the searching form which you use.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form like this: <form name=mine> <input type=text name=one> <input type=text name=two>
I have regular form like this. <form action=/domainchecker.php method=post> <input type=text name=domain size=20> <fieldset>
I have a form like this: one.php <form id='myFormId' name='myFormName'> <input type='text' name='myTextField'> <a
i have a form like this: <form method=post src=upload enctype=multipart/form-data> <input name=img1 id=img1 type=file>
If I have a form like this: <form> <input name=param[] /> <input name=param[] />
I have a form like this: <form id=form_main name=form_main action=/search/ target=iframe001 method=get onSubmit=reset_and_subm();> Enter
I have a form like this: class MyForm(forms.Form): [...] which is rendered in my
I have a form like this: <form id=loginCompact action=https://externalsite... name=sportsbook method=post onsubmit=createCookie('BRLOG', document.sportsbook.username.value, 1)>
I have a bunch of rows in a form like this <tr> <td nowrap><input
I have a datefield in a form like this: { xtype:'datefield', name:'order[date]', id:'dato', format:'d-m-Y',

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.