The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Getting File contents via AJAX from a dynamically created AJAX file list

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
  • #34291

    I have 3 basic components: A button called ‘Load’, a div called ‘articles’ and a textarea called ‘Editor’.

    I want to be able to push the button which will populate the div with available files (this presently works) and then I want to select a file from the div filelist, get it’s contents from the server and put it in the test area (having trouble with this).

    I presently have this:
    jQuery Code:

        $('#load').click(function() {
    //alert ("Clicked!!");
    return false;

    The server side code:

    $output = "";
    if ($handle = opendir($dir)) {
    while (($file = readdir($handle)) !== false) {
    if (is_file($file)) {
    $info = pathinfo($file);
    $fileName = basename($file, '.'.$info);
    $output .= "".$fileName."
    } else {
    $output .= "Can not open directory";

    echo $output;

    What needs to be done so that I can select a file in the div (that’s been dynamically generated) to fill the Editor?


Viewing 1 post (of 1 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.