I am working on an ajax panel that calls upon hitting submit. The submit button calls a function (checkRecord()) and then populates a data grid.
My question is:
I want to add functionality so when the user hits the “Enter” key then the same function gets called upon without reloading the page.
My problem:
The page gets reloaded when hitting the “Enter” key and it seems its calling my action but when the page gets reloaded it loses the call to the ajax function.
Here is my code:
[CODE]
function checkEnter(e){
var characterCode
if(e && e.which){
e = e
characterCode = e.which
}
else {
e = event
characterCode = e.keyCode
}
if(characterCode == 13){
checkRecord();
return false
}
else{
return true
}
}
I am calling it like this from my form:
[CODE]
<input name=”maintxtbox” type=”text” id=”maintxtbox” onKeyPress=”checkEnter(event)” />
Anyone has any suggestions so that my javascript function gets called without having to refresh the page? Thanks.