我用PHP创建了一个div进行预览,现在我需要在Dialog Jquery中显示它,是否可以在Jquery中直接传递php变量?我试过但是我的结果是一个空白的对话框!!
Jquery方面:
$(function() {
$( "#previewDiv" ).dialog({
autoOpen: false,
height: 200,
width: 700,
modal: true,
buttons: {
"Submit": function() {
$( this ).dialog( "close" );
$("#submit").click();
},
"Cancel": function() {
$( this ).dialog( "close" );
}
},
close: function() {
$('#').val("");
}
});
$( "#previewButton" ).click(function() { $( "#previewDiv" ).dialog( "open" ); });
});
和PHP:
$table=$_SESSION['data'];
if (isset($_POST['preview'])) {
if ($table) {
foreach($table as $keys=>$values) {
$pieces = explode(" , ",$values);
echo "<div id='previewDiv'>"
echo "$pieces[0]";
echo "$pieces[1]";
echo "</div>";
}
}
感谢您的帮助!!!