html - onsubmit javascript and form -


the problem onsubmit not working when click on submit ,it go on action not on submit

<form action="http://www.client.ad-saver.com/registration/simpleregister?      email=yusuyaauu@gmail.com" onsubmit="return myfuncmyfunc();"  method="post">            <input class="email" type='text' name='email' placeholder='e-mail' value=""/>            <input class="submit" id="sub" type="submit" value='Регистрация' name='reg'/>   </form> 

this js:

function myfuncmyfunc () {     var crossdomainrequest = {         callbackcounter: 0,         fetch: function (url, callback) {             var fn = 'jsonpcallback';             window[fn] = this.evaljsonp(callback);             url = url.replace('=jsonpcallback', '=' + fn);             var scripttag = document.createelement('script');             scripttag.src = url;             document.getelementsbytagname('head')[0].appendchild(scripttag);         },         evaljsonp: function (callback) {             return function (data) {                 var validjson = false;                 if (typeof data == "string") {                     try {                         validjson = json.parse(data);                     } catch (e) {                     }                 } else {                     validjson = json.parse(json.stringify(data));                 }                 if (validjson) {                     callback(validjson);                 } else {                     throw ("jsonp call returned invalid or empty json");                 }             }         }     }  crossdomainrequest.fetch("http://www.client.ad-saver.com/registration/emailvalidation?email=wdlebedcom",  function (data) {         alert(data.message);             }); } 

i need alert,then action , location on action after on submit

myfuncmyfunc() should return false prevent submitting form server


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -