Ruby on rails:如何从登录弹出窗口向用户提供的凭据发送一个AJAX请求到rails控制器

另外,如何使用弹出窗口中输入的值,在javascript函数中: login_request() ,它在click上被调用,最终将发送AJAX请求。

注意:代码段包含弹出窗口中包含的所有字段。

  
<!----> <!----> <!---->
<!----> <!----> <!---->
" style="max-width: 100%;" />

谢谢。

  function login_request(data_to_send) { $.ajax({ type: 'post', url: 'controller/action', data: { key: "value" key_1: "value_1" }, success: function(data) { // paste your code here after success } }); } #in your config/route.rb match 'controller/action', :to => 'controller#action' ,:via => [:get,:post] # i'm using get as well as post also. #hope that help you. if you face any problem please let me know