php - submit value of radio button with jquery with onClick event -


i have simple toggle button on page uses 2 radio inputs:

foo:  <input type='radio' name='foo' value='bar'> bar <br> <input type='radio' name='foo' value='fru'> fru  

is there short , easy way (preferably jquery) of asynchronously submitting value of foo each time clicked?

the radio buttons above form elements on page.

something maybe?

<script>     $(document).ready(function() {       $("input:radio").change(function(){          $.post('ajaxscriptlocation.php', { "foo": $(this).val() }, function(data) {            // whatever data result.          });       });     }); </script> 

Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -