Con AJAX? no te estaras confundiendo??
Código HTML:
Ver original <script language="javascript"> function onlyNumbers(evt){
var keyPressed = (evt.which) ? evt.which : event.keyCode
return !(keyPressed > 31 && (keyPressed < 48 || keyPressed > 57));
}
<input onkeypress="return onlyNumbers(event)" type="text" />