0

我是 RoR 的新手,我想知道如何根据我的项目使用字段进行谷歌搜索,有人知道我该怎么做吗?

我的 application.html.haml 中有代码:

 %form#search
  %input

我该如何实施?

4

1 回答 1

1

action表单的 of 设置为http://www.google.com/searchmethodtoget并命名您的input字段q。类似于以下内容:

%form#search(action="http://www.google.com/search" method="get")
  %input(type="text" name="q")
  %input(type="submit")

结果将是 google 搜索的正常 URL,并显示结果:

http://www.google.com/search?q=term1+term2
于 2011-11-04T17:56:04.690 回答