0

I am trying to make ajax POST request but always get error as "Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at "myURL". This can be fixed by moving the resource to the same domain or enabling CORS." and "No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access." I am able to post data to server but can't get response from server.

1
  • 1
    You might want to check out en.wikipedia.org/wiki/Same-origin_policy Basically, you'd have to configure the server to send the right headers or use jsonp. Commented Feb 16, 2015 at 11:53

2 Answers 2

2

Same origin policy is implemented by default and you should stick to it http://api.jquery.com/jQuery.ajax/.

However if you want to make cross-domain request you can do that through JSONP http://en.wikipedia.org/wiki/JSONP http://json-p.org/ . Type data:"jsonp" and you will get it. Make sure you actually needed this.

Sign up to request clarification or add additional context in comments.

Comments

0

Limitations of making jsonp request is that we can perform only "GET" request to server.What I wanted was making cross domain "POST" request.I found one solution for such situations. Install xampp server create proxy server () deploy html project on proxy server and then make normal "POST" request using jquery.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.