ruby点击页面弹出框

Python018

ruby点击页面弹出框,第1张

var DATA='[{"data":{"x":{"precision":2,"subtype":"","type":"array","unit":" ","value":[-23.93000030517578]},"y":{"precision":2,"subtype":"","type":"array","unit":" ","value":[-8.890000343322754]}},"devtype":"DAIS","msg":"multidata","netid":1128,"nodid":2501,"nvsid":2001181,"version":2}]'

eval(DATA)

puts "hello 是写在rb文件中的

eg

app/controllers/hello_controller.rb #画面的控制

class HelloController <ActionController

def index

@hello = "hello"

puts @hello # "hello"

end

end

app/views/hello/index.rhtml

<table border="1">

<tr>

<td><%=@hello%></td> #@hello 或者$hello 这种变量才能在页面中使用

</tr>

</table>

地址是:http://localhost:3000/hello/say

Net::HTTP.new方法,返回resp码和实际的data:

require 'net/http'  

h = Net::HTTP.new("www.baidu.com",80)  

resp,data = h.get("/")   

puts resp  

puts data