jQuery modal 执行得很好,但是当表单被php成功执行时,我想显示警告消息时,我不知道我错过了什么?
$.post(
'name.php',
{ ime: ime, location: location },
function(data){
if (data.success) {
alert("form posted!");
}
else {
$("#dialog-form").dialog("open");
}
},
"json"
);
==========================PHP============
if ($result == false) {
echo json_encode(array('success' => false, 'result' => 0));
exit;
}
echo json_encode(array('success' => true, 'result' => $result));
$sql2 = "DELETE FROM $names WHERE name='$ime'";
$result2 = mysql_query($sql2);