开发者

Jquery with PHP problem

Let me post the code first.

function alertCallback<?=$position_info['id']?>()
    {
            var id  =       <?=$position_info['id']?>;
            var itemname=    '<?=$na?>';
<?PHP if($position_info['name'] == $wposition){ ?>
var reward = '<?= $itmname ?>';
$('#selected_item').html(''+itemname+reward);
<?PHP item_add($_SESSION['userid'],$itmid,1); } else { ?>
var noreward = 'You Found Nothing!';


$('#selected_item').html(''+itemname+noreward);
<?PHP } ?>

}

The above is working to an extent. The page is a image map where if you click 开发者_如何学Goon the right spot then you get an item. It is currently working where if you click on the right spot you get the item. Or get told you found nothing.

The problem I have is that the page reloads to set new positions

<script type="text/javascript">
//one seconds=1000 micro seconds
setInterval(function() {
   $('#load').load('itemclick_ajax.php');

 },60000);
</script>

but another item is won as long as the page is displayed. Any ideas on how to stop this occuring. If i keep the browser showing the page then im running up to thousands of items won.


Are you trying to stop the page reload?

Try adding "return false;" at the end of your Javascript function.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜