我通过jquery在YUI面板(DOMInserted)中填充元素值
这是php
<?php
$con = mysql_connect('sql', 'admin', '123');
mysql_select_db('sql');
$data_parent_type0 = mysql_real_escape_string($_POST['data_parent_type0']);
$result = mysql_query('SELECT id,name FROM email_templates WHERE description = "'.$data_parent_type0.'" AND deleted = 0');
while($row = mysql_fetch_assoc($result)) {
echo '<option value="'.$row['id'].'">'.$row['name'].'</option>' . "\n";
}
mysql_close($con);
?>
这是JQUERY
$(document).bind('DOMNodeInserted', '#composeHeaderTable0', function(event) {
$("#data_parent_type0").click(function() {
var data_parent_type0 = $('#data_parent_type0').val();
//alert(data_parent_type0);
$.post("dbcall.php", { data_parent_type0: data_parent_type0},
function(result){
//alert(result);
$("#email_template0").html(result);
});
});
});
它可以工作,但会导致Apache挂起。