ruby on rails - Cross-Origin Request Blocked with Ajax after taking site to SSL -
we using ruby 2.1.2 rails 3.2.14. getting following error on browser's console ajax requests after moved our site ssl.
cross-origin request blocked: same origin policy disallows reading remote resource @ https://sitename.com/xxx/xx?id=xx. can fixed moving resource same domain or enabling cors.
we've tried adding
headers: { 'access-control-allow-origin': '*' }, crossdomain: true
but no effect. here ajax code :
$.ajax({ type: "get", data: {id: id}, url: path+id, headers: { 'access-control-allow-origin': '*' }, crossdomain: true, success: function(data) { } });
any other suggestions??
you have set headers on server side. not on client. simplest way use in applicationcontroller:
after_filter :set_access_control_headers def set_access_control_headers headers['access-control-allow-origin'] = '*' end
Comments
Post a Comment