Jquery AJAX (json) cross domain request and ASP.NET MVC -
seemed me beaten theme, couldn't find answer. =( make jquery ajax requst localhost:666 localhost:555 application
$.ajax({ url: "http://localhost:666/request", datatype: 'json', timeout: 5000, success:...
i've got in chrome:
xmlhttprequest cannot load http://localhost:666/request. origin http://localhost:555 not allowed access-control-allow-origin.
what solution of problem?
you can initiate cross-domain request in webpage creating either xmlhttprequest object or xdomainrequest object. end user's web-browser request data domain's server sending "origin" header value of origin. if server responds "access-control-allow-origin: * | origin" permitted access data; otherwise response unauthorized request.
protected void application_beginrequest(object sender, eventargs e) { httpcontext.current.response.addheader("access-control-allow-origin", "*"); // httpcontext.current.response.addheader("access-control-allow-origin", "http://alloweddomain.com"); }
an article here: cross-origin requests , asp.net mvc
Comments
Post a Comment