php - Adding a second form from Ajax output -


i working on admin module db-project. user chooses table dropdown , jquery submits name of table php selects fields, composes , echoes it. works charm.

function ajax_search(){        $("#table_list").show();        var search_val=$("#tables").val();        $.post("./ajax/xxxxx.php", {searched_table : search_val}, function(data){        if (data.length>0){           $('#spinner_div').hide();          $("#table_list").html(data);         }        })      }   

now add form under table adding 1 row. if hard code form on html-page , uses jquery like

function ajax_add(){        $("#table_list").show();        var add_val=$("#manufacturer").val();        $.post("./ajax/xxxxxx.php", $("#addform").serialize(), function(data){           if (data.length>0){             $('#spinner_div').hide();             $("#table_list").html(data);         }        })      }  

i can catch in php , add row. create form after have submitted first form because there number of different tables different needs.

i have tried add form echo after building result table like

echo "<form method='post' name='addform' id='addform'> <input type='hidden' name='add'>.... 

the table shows in output , looks ok in chromes element inspector. form never submitted php because "submit" not caught by

$(document).ready(function(){     .....     $("#add_button").click(function(e){         $('#spinner_div').show();         e.preventdefault();          ajax_add();      }); }); 

is not possible add form after page has been read first time?

if have been unclear in describing problem best answer questions.

regards

mats


Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -