Ruby on rails: How to send an AJAX request to rails controller from login popup along with user given credentials

后端 未结 1 1769
悲&欢浪女
悲&欢浪女 2021-01-25 07:03

Also, how to use the values entered in the popup, in the javascript function: login_request() which is being called on click, which will send the AJAX request event

相关标签:
1条回答
  • 2021-01-25 07:43
     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
    
    0 讨论(0)
提交回复
热议问题