i have following problem. have jquery script loads ajax every second page. when response "go" should redirect other page. works only, when directly gets "go" response. if response first other , "go", doesn't work. why?
here code:
setinterval(function() { $("#reset").load('game/gamehandler.php'); var data = $('#reset').html(); if(data[0]+data[1] == 'go'){ $('#answer').modal('hide'); alert('du kannst spielen!'); var url = "http://www.guido-muehlwitz.de"; $(location).attr('href',url); } }, 1000); $.ajaxsetup({ cache: false });
in place of
if(data[0]+data[1] == 'go'){
try these:
if (data.indexof("go") >= 0){ note case-sensitive. if want case-insensitive search, can write if (data.tolowercase().indexof("go") >= 0){ or, if (/go/i.test(data)){
Comments
Post a Comment