var error=0; function testemail(){ url = '/subscribecodeajax.php'; new Ajax.Request(url, { method:'get', parameters: $('aform').serialize(true), onSuccess: function(transport){ var response = transport.responseText || "x"; // alert(response); if ( response == 'x') {$('aform').test.value=0;getpage();} else {alert ( 'invalid email');} } }); } function getpage() { $('submit').disable(); url = '/subscribecodeajax.php'; new Ajax.Updater('feature', url, { method: 'get', frequency: 3, decay: 2,evalScripts: true, parameters: $('aform').serialize(true), onSuccess: function(transport){ var response = transport.responseText || "x"; // alert(response); $('submit').enable(); } }); }