how to implement ajax in Ruby on rails via jquery

Posted by swaroopsm on Stack Overflow See other posts from Stack Overflow or by swaroopsm
Published on 2012-06-19T15:13:12Z Indexed on 2012/06/19 15:16 UTC
Read the original article Hit count: 206

Filed under:
|
|

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?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about ruby-on-rails