3

Is there a way to send a POST request using AngularJS despite the same-origin policy? I don't need to get the response from the request, I just need to send the request. Just like creating a form and sending it to another server.

Thanks

3
  • what happened when you tried it? Commented Apr 3, 2013 at 11:31
  • It says that I don't have the same origin Commented Apr 3, 2013 at 11:45
  • same origin security restrictions are monitored by the browser itself regardless of whatever javascript framework you use...use a proxy on your domain to make post to other domain Commented Apr 3, 2013 at 11:50

1 Answer 1

2

You can use JSONP to send a request to another domain, however you can't use POST, it would have to be a GET request. Can you serialize your form values and send using GET?

http://docs.angularjs.org/api/ng.$http#jsonp

How to use type: "POST" in jsonp ajax call

Keep in mind that if you do use GET, you are limited with how much data you send, since URLs usually can't be over ~2000 characters.

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

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.