javascript - open jquery-ui dialog based on ajax response -
i'm trying open jquery-ui dialog when response of checklatestnews.php meets condition rec != "0". created test checklatestnews.php file response "1", yet jquery-ui dialog still not open. appreciated.
<div id="dialog"> <script type="text/javascript"> $("#dialog").dialog( { bgiframe: true, autoopen: false, height: 100, modal: true } ); </script> <script type="text/javascript"> var check_latestnews; function checkforlatestnewsnow() { var str="chklatestnews=true"; jquery.ajax({ type: "post", url: "checklatestnews.php", data: str, cache: false, success: function(res){ if(res != "0") { $("#dialog").html(response).dialog("open"); } } }); } check_latestnews = setinterval(checkforlatestnewsnow, 5000); </script>
$.post("checklatesnews.php", {action: "check"}, function(response) { ..... $("#dialog").dialog("open"); });
Comments
Post a Comment