jQWidgets Forums

jQuery UI Widgets Forums Grid Using Combobox to pass value to MySQL to Populate Grid

Tagged: ,

This topic contains 1 reply, has 2 voices, and was last updated by  Peter Stoev 13 years, 1 month ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author

  • dazzabiggs
    Member

    I have a combobox populated from a query on a MySQL database. This works. I want to be able to use the value of the selection made to help populate a grid. I want to be able to pass the value to the data.php file to use inside the MySQL SELECT query to populate the grid.

    I am guessing this can be done using AJAX but I am unsure of how to go about it and have made several failed attempts at it.

    Thanks in advance.

    Darren


    Peter Stoev
    Keymaster

    Hi Darren,

    You can bind to the ‘select’ event of the ComboBox and make an ajax call passing the selected value.

    Something like:

    $('#jqxComboBox').bind('select', function (event) {
    var args = event.args;
    var data = "selecteditem=" + args.index;
    $.ajax({
    dataType: 'json',
    url: 'data.php',
    data: data,
    success: function (data, status, xhr) {
    }
    });
    });

    In the PHP code, you have to then check for “selectedItem”.

    if (isset($_GET['selecteditem']))
    {
    $selectedItem = $_GET['selecteditem'];
    }

    Hope this helps.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.