- I cant use AJAX (XMLHTTPRequest) because of Same-Origin-Policy.
- I cant access the Server internals, neither do I have the Server-Code.
- The Server only supports HTTPMethods:
POST, OPTIONS - I cannot use a third server (e.g. for using curl)
I can use a form-Post
<form method="post" action="some-web-server.com/something.JSON"> <input name="param" value="some JSON param" /> </form> to get the answer but I getting redirected to the JSON.page to get the answer. Is there a possibility to get the response in JS? something like that:
<form target="javascript: someFunctionUsingTheResponse(this.submit())" method="post" action="someServer/st.JSON" > and in the HTML-Head
<script type="text/javascript"> function someFunctionUsingTheResponse(text){ alert(text); } </script> UPDATE: I already tried to create an <iframe name="dummy"> and setting the target of the form to this dummy-iframe <form target="dummy"> which works quite good (in Chrome, not working in IE), but i still cannot access the data of the iFrame using JS. (origin Policy)
curlfrom there to get the answer from the remote JSON and then return that value to your front-end.jsonpis what you needjsonpis great but as far as I know the remote server has to support it or it won't work, i.e. wrap everything in the callback param, so it might not be an option for OP.curlfrom the server side then it's fine even if it's a different domain (as long as you can access it and it's not blocked from the outside etc). An example of what curl is: stackoverflow.com/questions/3062324/what-is-curl-in-php