hi
<input type="button" onclick="ajaxFunction()" name="calculate" value='Calculate' />
i have the above on a page, if i click the button, my ajax function works fine. however, if i press "enter", the form submits but nothing happens - no doubt as the function is called "onclick"
is there any way to change this so the user may click the button, or press enter on the keyboard, and have the form submit to ajax correctly?
thanks
updated:
ajaxRequest.onreadystatechange = function(){
if(ajaxRequest.readyState == 4){
var ajaxDisplay = document.getElementById('ajaxDiv');
ajaxDisplay.innerHTML = ajaxRequest.responseText;
}
}
var gold = document.getElementById('gold_amount').value;
var carat = document.getElementById('carat').value;
var queryString = "?gold=" + gold + "&carat=" + carat;
ajaxRequest.open("GET", "script.php" + queryString, true);
ajaxRequest.send(null);
}
//-->