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
Post a Comment