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

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -