I'm having trouble with this fuction/AJAX call... I'm somewhat new to javascript, and i cant figure out what is wrong...
I'm trying to send the call to my other php page called "calculate.php" (without quotes), it is supposed to package up the variables and send them to the php page, and then display the results in a <div> tag...
Could someone help me figure out whats wrong with my code? Thanks in advance!!!
Heres the code:
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script type="text/javascript">
var helm = "1";
var weaponh = "1";
var weapon = "1";
var armor = "1";
var shield = "1";
function stats() {
$(".link").click(function stats() {
$.ajax({
url: "calculate.php",
data: 'helm='+helm+'&weapon='+weapon+'&armor='+armor+'&shield='+shield+'&weaponh='+weaponh+'',
cache: false,
success: function stats(html){
$("#results").append(html);
}
});
});
});
</script>
</head>
<body>
<a href="#" id="link" class="link">Update Stats</a><br />
<div id="results" class="results">
</div>
</body>
</html>

New Topic/Question
Reply


MultiQuote




|