/    Sign up×
Community /Pin to ProfileBookmark

beginner in ajax need help

hi iwant know why this code don’t work with me itry make user buy wood and then update his information in datebase

<html>
<head>
<script language=”javascript” type=”text/javascript”>
<!–

function buy(nomber,ink){
var ajaxRequest; // The variable that makes Ajax possible!

try{
// Opera 8.0+, Firefox, Safari
ajaxRequest = new XMLHttpRequest();
} catch (e){
// Internet Explorer Browsers
try{
ajaxRequest = new ActiveXObject(“Msxml2.XMLHTTP”);
} catch (e) {
try{
ajaxRequest = new ActiveXObject(“Microsoft.XMLHTTP”);
} catch (e){
// Something went wrong
alert(“Your browser broke!”);
return false;
}
}

}

// Create a function that will receive data sent from the server
ajaxRequest.onreadystatechange = function(){
if(ajaxRequest.readyState == 4){

}
}
ajaxRequest.open(“GET”,ink, true);
ajaxRequest.send(‘nomber=’+nomber);

}

nomber=””;
function submitnum(bname){
nomber+=document.getElementById(bname).value+””;
document.getElementById(bname).value=””;
}
//–>
</script>
</head>
<body bgcolor=#CCA37A>

<table align=left width=600>
<tr><td bgcolor=orange colspan=2>Market</td></tr>
<tr><td onmouseover=”this.style.background=’#FECE6E’; ajaxFunction(‘buildinfo.php?type=wood’,’info’);”
onmouseout=”this.style.background=’#CCA37A'”>Wood</td><td><input type=text id=bi><input type=submit onclick=”submitnum(‘bi’);buy(nomber,’buy.php’);”></td><td rowspan=3><div id=info></div></td></tr>

</table>

</td></tr></table>
</body>
</html>

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@rtkwarauthorApr 25.2012 — Any one can reply and tell me whats wrong why this code don't work?
×

Success!

Help @rtkwar spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.20,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...