I'm trying to load a link in my coffeescript file like so:
$.ajax hobby.link,
type: 'GET'
dataType: 'html'
error: (jqXHR, textStatus, errorThrown) ->
console.log "AJAX Error"
success: (data, textStatus, jqXHR) ->
console.log "Successful AJAX call"
and have installed
gem 'rack-cors', :require => 'rack/cors'
and added
config.middleware.insert_before 0, Rack::Cors do
allow do
origins '*'
resource '*', :headers => :any, :methods => [:get, :post, :options]
end
end
to my application.rb, but everytime I get
XMLHttpRequest cannot load http://www.example.com/. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access.
What else do I need to do to make these loads work?
Note that I'm currently performing that ajax call to three different links in a row.