开发者

Return Value On Form Submission in Rails w/ Ajax

开发者 https://www.devze.com 2023-03-22 05:25 出处:网络
So here\'s what I want to do. User fills in the form (Just a textbox and submit) The record is added in the background

So here's what I want to do.

  1. User fills in the form (Just a textbox and submit)
  2. The record is added in the background
  3. The created record's ID i开发者_StackOverflow社区s returned
  4. A URL (based on the ID) is displayed

How could I go about achieving something like this? Does anyone have any reading material which would help me with it?


Any scaffold will provide you with almost all the code you need to achieve this.

Then add :remote => true to the form and change slightly the flash message to display resource_name_path(@resource)

0

精彩评论

暂无评论...
验证码 换一张
取 消