how to implement ajax in Ruby on rails via jquery
- by swaroopsm
how do i pass few of my form field(s) values to a controller usnig ajax/jquery?
For eg.: In php/jquery I do something like this:
$("#test-btn".click(function(){
var name=$("#name").val();
var age=$("#age").val();
$.post("insert.php",{name: name,age: age},
function(data){
$("#respone").html(data).hide().fadeIn(500);
});
});
//insert.php
<?php
//insert values to database!
?>
how do i acheive a similar functionality in rails using ajax/jquery?