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

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -