Jump to content

DaFlyinGoose

Members
  • Posts

    2
  • Joined

  • Last visited

DaFlyinGoose's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. cheers, i also made a mistake when calling the function which didnt help.
  2. hey guys, i just started playing with ajax, Iam a php coder and i have little clue about javascript. I set a html page when onclick of a button to carry out the function mybattlecheck(a,:)a being an database id and b being an amount of people involed.I tried to make it so that it loops through the code 'b' times. function stateChange(i) { if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { document.getElementById("w1_armour" + i).innerHTML=xmlHttp.responseText } }function mybattlecheck(a,b){var battleid = avar attackers = bvar i = 0while (i <= b){xmlHttp=GetXmlHttpObject()if (xmlHttp==null) { alert ("Browser does not support HTTP Request") return } var url="damagecheck6.php"url=url+"?battle_id="+battleidurl=url+"&attacker_id="+iurl=url+"&varible=1"xmlHttp.onreadystatechange=stateChangexmlHttp.open("GET",url,true)xmlHttp.send(null)stateChange(i)i++}} Thats my code, at 'while (i <= b )' it doesnt seem to loop, yet i change b to a number, say two then it loops. Can anyone help me before i pull my hair out :'(
×
×
  • Create New...