How to load PHP through jQuery and append it to an existing div container -


i'm attempting create "click add" link user can click many times necessary. each time click it, 3 additional input fields pop up. this, i've got jquery loads php file creates 3 additional inputs , loads them existing div container.

my problem after user has clicked "click add" link once , seen 3 new input fields, if click "click add" second time, initial 3 fields wiped out new 3 fields being added. how can remedy each time user clicks 3 fields added , prior ones preserved well.

(note: i've looked using append() in conjunction jquery have below must getting syntax incorrect if indeed best solution).

my jquery here:

    var loadphp = "create_new_bucket.php";       $(".add_bucket").click(function(){           $("#tree_container2").load(loadphp);         return false;     });   

jquery.load() replaces content in container. 1 way around append new element object, , populate element new html.

example:

$('#tree_container2').append( $('<div />').load(loadphp) ); 

Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -