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

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.

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.