mercredi 31 décembre 2014

JQUERY refill while emptying


I'm trying to smoothly reload this div. `


grabchart(userid, div); purpose is to fill the div with users data.



$( ".reload" ).click(function() {
if($("#line-example-refresh").is(':empty') && ($("#line-example:not(empty)"))) {
$( "#line-example" ).empty();
<?php echo 'grabchart('.$_COOKIE['uid'].',"line-example-refresh");';?>
}

if($("#line-example").is(':empty') && ($("#line-example-refresh:not(empty)"))) {

<?php echo 'grabchart('.$_COOKIE['uid'].',"line-example");';?>
$( "#line-example-refresh" ).empty();
}
});


What's happening here is that my script verify the first statement and then clear #line-example, then since it just cleared this div, it makes the second statement true. What i need is verify if one of twos statement is true then halt the script.





Aucun commentaire:

Enregistrer un commentaire