How to reload the page with sending the form in a java script? By pressing the radio button, reload the page and send only the data of the button to the data post ...

    3 answers 3

    $('input:radio').click(function(){ var value = this.value; $.post('url', {'data': value}, function(){ location.reload(); }); }); 

    Joukweri. If necessary, I can just write javascript.

       <form> <input type="submit" value="Добавить"/> </form> <script language="JavaScript" type="text/javascript"> /*<![CDATA[*/ try { document.forms[0].submit(); } catch(e) {} /*]]>*/ </script> 
      • it works, but you only need to send the entire form, but only a part of it is currently implemented crookedly document.getElementById ('e2'). value = ''; document.getElementById ('s1'). selectedIndex = '0'; document.getElementById ('s2'). selectedIndex = '0'; document.getElementById ('s3'). selectedIndex = '0'; document.getElementById ('s4'). selectedIndex = '0'; document.forms ["mf1"]. submit (); and only 4 radio buttons are subject to dispatch. how to remake it so that it is to send a request and not to press the button to submit the form?) - Vladimir Klykov
      • Before sending the form, disable disabled unnecessary radio buttons, the form will not send them. And then the Radio buttons always send only one value. A few checkboxes. - Yoharny Babay

      Strange task, why this may be needed, if not a secret?

      I see 2 solutions:

      1. split the form into several forms
      2. use ajax in the form of jquery.post, collecting the necessary data from the form ( Jquery.POST )
      • Changing the language of the page and the database to which it is attached, i.e. there is a radio button for the language, a radio button for sorting. Py.sy left as was) - Vladimir Klykov