Passing javascript variables to rails controller

后端 未结 3 1642
予麋鹿
予麋鹿 2020-12-30 09:51

Here is the problem i\'m stuck on. I want to pass the javascript variables to the rails controller.



        
3条回答
  •  情书的邮戳
    2020-12-30 10:32

    You can use something like

    $.post("/bookings?booking[phone]=" + phone + "&booking[book_date]=" + mdate)
    

    It will go to BookingsController#create action with params hash:

    { booking: { phone: "entered from prompt", book_date: "26 December 2013" } }
    

提交回复
热议问题