Javascript-forms-php and listing files on remote disk

Discussion in 'JavaScript' started by lorife, Oct 15, 2011.

  1. #1
    Hi, I'm new here, I registered because it looks like a great forum and because, of course, i need some help. I'm using jquery, php, javascript. What I need to achieve is this: 1) i have a jqgrid with some data in it. last column of the grid is a button. 2) I created a simple form in a php file called "ftest" 3) when user click the button i open a dialog using jqgrid "gridtoform" function and passing "ftest" parameters. 4) problem is: In the dialog-form opened i want to list all the files in a particular folder. Folder name is the first column of the record clicked. I created a little function that lists all the files in a folder, but I don't know how to send the folder name from javascript to php (i imagine i can't). I don't have many ideas, probably I need to create the form from javascript, before calling the Grid-to-form funcion..but I don't know how to do it..and even if i knew, I don't know how to call the php function that lists my files from javascript. Could you please help me? thank you so much!
     
    lorife, Oct 15, 2011 IP
  2. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #2
    $.ajax()

    See http://api.jquery.com/jQuery.ajax/

    As far as getting the name from the first column of the clicked row, there are examples on the jqGrid site. (And in the forum, IIRC.)

    You can't "send the folder name from javascript to php" while PHP is creating the page. (PHP runs on the server, creates the page and sends it to the browser. That's the end of what happens, unless you trigger something else - which is what AJAX does.)
     
    Rukbat, Oct 16, 2011 IP