开发者

Return Value On Form Submission in Rails w/ Ajax

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜