michelleisconfused michelleisconfused - 1 year ago 105
jQuery Question

open jquery-ui dialog based on ajax response

I'm trying to open a jquery-ui dialog when the response of checklatestnews.php meets the condition rec != "0". I created a test checklatestnews.php file where the response is always "1", yet a jquery-ui dialog will still not open. Any help would be appreciated.

<div id="dialog">

<script type="text/javascript">

bgiframe: true,
autoOpen: false,
height: 100,
modal: true

<script type="text/javascript">

var check_latestnews;
function CheckForLatestNewsNow() {
var str="chklatestnews=true";
type: "POST",
url: "checklatestnews.php",
data: str,
cache: false,
success: function(res){
if(res != "0") {



check_latestnews = setInterval(CheckForLatestNewsNow, 5000);

Answer Source
$.post("checklatesnews.php", {action: "check"}, function(response) {