如果返回 0 ,我需要运行jQuery 模态对话框mainOptim.php
。现在 Firebug 说$dialog is not defined
。我应该在代码中更改什么?
<script type="text/javascript">
$(document).ready(function() {
var $dialog = $('<div></div>')
.html('This dialog will show every time!')
.dialog({
autoOpen: false,
title: 'Basic Dialog'
});
});
function click_function_ps() {
$.ajax({
url: 'callpage.php?page=optim/mainOptim.php',
data: 'earl='+$('#earl').val(),
success: function(html,msg){
if(msg === '1'){
$('#opt_container').html(html);
} else {
$dialog.dialog('open');
return false;
}
}
});
}
</script>
<div id="fragment-2">
<table width="100%">
<tr>
<td width="100%">
<form name="optform" method="post" action="#">
<div class = "boxx">
<label for="earl"><span>Parameter:</span></label>
<input type="text" class="input-text" value="5" size="11" maxlength="11" name="earl" id="earl">
</div>
<br/>
<div class="buttons">
<a href="#" class="regular" onclick="click_function_ps();">
<img src="images/opt.png" alt=""/> Run
</a>
</div>
</form>
</td>
</tr>
</table>
</div>