蕲春人的博客

About Blog Email GitHub

17 Aug 2011
Set proxy in server side to get crossing domain ajax request

class ProxyController < ApplicationController

  # GET /proxy/:url
  def get_handle
    require 'open-uri'
    file = open(params[:url])
    contents = file.read
    render :text => contents
  end

end
    get "/proxy" => "proxy#get_handle"
```
$.get("/proxy?url=" + remote_url, function(data){
```

蕲春人 at 23:12

scribble

About Blog Email GitHub