这基本上是我想要做的,因为有人以某种形式向某个地点提出GET/POST的要求,这个网站希望有一个特定的URL,如,并将给我一个JSON,我想在提交表格时将这名JSON的数据与我的铁路连接。
我以这种方式完全失职,将非常感激。
Railways Form Data =>Building the URL => Do a GET/Post request => Catch JSON => Parse => Save
这基本上是我想要做的,因为有人以某种形式向某个地点提出GET/POST的要求,这个网站希望有一个特定的URL,如,并将给我一个JSON,我想在提交表格时将这名JSON的数据与我的铁路连接。
我以这种方式完全失职,将非常感激。
Railways Form Data =>Building the URL => Do a GET/Post request => Catch JSON => Parse => Save
for rest api you can use activeresource in your application http://api.rubyonrails.org/classes/ActiveResource/Base.html
如果它具有非常具体的内容,你可以使用网: Http. 提出请求,然后由 yourself将json to带给废墟。
http://www.rubyinside.com/net
for decoding json you can use Json or ActiveSupport::JSON.decode or this https://github.com/flori/json
我猜想你想向不是你的所在地的其他人提出答复。 因此,你可以安装 curb灯(在废墟中安装 cur窗)。 然后,它利用Json至Ah等固定的RoR工具,在另一个地点和分区提出要求。
http://www.rubyinside.com/net 你可以做以下工作:
在您的档案中添加:
require "net/http"
require "uri"
require json
当时担任你的控制员或助手:
#set the uri
uri = URI.parse("http://my.site.com/uri")
#set the post params and get the respons
response = Net::HTTP.post_form(uri, {"first_param" => "my param", "second_param" => "another param"})
#get the json info
data = JSON.parse(response.body)
#set result to an ActiveRecord (maybe there is a better way to do this, I guess it depends on the response you get
@something = Mymodel.new
@something.name = data["name"]
...
@something.save
希望!
I am trying to develop my login script to give feedback to the user if the login is valid or not. Basically if it isn t correct a div box will show saying its wrong, if its correct it will show its ...
I m trying to find a reusable way to set focus from one text box to another upon enter using ASP.NET, but using client-side JavaScript to do so. The only reason I mention this is to be done in ASP....
I have some Javascript JQuery code that does an Ajax call to the server every 5 mins, it s to keep the server session alive and keep the user logged in. I m using $.ajax() method in JQuery. This ...
Why are my AJAX requests failing? I have a website www.foo.com, and I m running Tomcat on the same server, www.foo.com:8080/services. However, when a file on foo.com makes an ajax call as such: $....
I want to know if there are existing technology that make your 3d models in sketch into virtual tours, using either Ajax or Flash for web presentation. If there s none, which will be a good approach ...
I have a entry form. Below it, I want to show a grid containing existing records. As the user clicks on a row of the grid, the values must get filled in the fields of the form above. Is there any way ...
I have asp.net application where i have a div which showing the value from other site. The value of that site is changing continuously. I want that my div will automatically update in some interval ...
Ok, I m stumped. Basically, this script works fine in FF, but not in IE (6,7 or 8) - in which it returns an "Object doesn t support this property or method" error. Any ideas?: function ...