Been working on a donation system made in jquery,where guild members could donate gold for the guild's benefit.
The wierd thing is that I had no problem with it until today,when I found out that it doesnt work as it should be,
e.g: if someone inserts an amount of gold to donate,it would show the alert box with the donated amount,refresh the page but wont call the .php script anymore(and the wierd thing is that it doesnt happen all the time,sometime it works

In ie works fine,but in firefox and chrome it has this wierd bug(didnt checked the other browsers).
I'm gonna post the jquery script and the donation form:
Code: Select all
<script>
function doAjaxPost() {
// get the form values
var field_a = $('#field_a').val();
var field_b = $('#field_b').val();
var field_c = $('#field_c').val();
$.ajax({
type: "POST",
url: "gdonate.php",
data: "amount="+field_a+"&player="+field_b+"&pid="+field_c,
success:alert("The amount of "+field_a+" silver was donated")
});
}
</script>
<script type="text/javascript">
$(document).ready(function()
{
$('#submit').click(function()
{
location.reload();
});
});
</script>
Code: Select all
<form action="" method="post">
<input type="text" id="field_a" size="30" maxlength="30">
<input type="hidden" id="field_b" value="<?php echo $player; ?>"/>
<input type="hidden" id="field_c" value="<?php echo $pid; ?>"/>
<input type="button" name="submit" id="submit" value="Donate" onClick="doAjaxPost()"></form>
Alexander,