Jump to content

Display another file on button click in div on same page


pfoster77

Recommended Posts

On your list of orders on the left column, you will need to add a listener which will trigger some code whenever it is clicked.  This is all client side and will be implemented using JavaScript or if you prefer some JavaScript library such as jQuery.

It will send some unique identifier (the order's PK if you wish) to the PHP server which will query the DB and return the results, and your javascript will then update the right column with the data received using something maybe like the following:

$(".a-class-on-each-row-of-your-left-column").click( function() {
    $.get (
        "yourServer.php",           // if empty, evidently it will go to the server which rendered the page
        {id: $(this).data('my-id')},// data to send.  Use either this or $(this) to get the ID from the row
        function(resp) {            // process response
            // update your right column with code here.  To see the data first, use:
            console.log(resp)
        }
    )
})

Maybe a little too abstract but hope you get the idea.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.