I am working on a project where the server has a back-end code in ServerA, and my front-end code, Which is to talk back-end through AJAX requests on ServerB, and they are in different domains. Due to the same basic policy, I am not able to do those requests successfully (neither post nor GET) Is it possible to enable JSONP to handle it without any change in the back-end code? For example, white list, special domains, or something else?
I tried to simulate it in my local network where the back-end code is running on 10.0.1.4 (different machine), and I'm accessing it from the local host (Apache), but There is no need to use JasonPi, which can not explain anything when called, I do not see anything in the log in the back end, but it works well with the REST customer and for GET requests Loading URL. How are the public API requests implemented, which are not using JSONP?
I need at least one method (post or GET) to work. Thanks.
Can it be enabled in any way, without changing the back-end code JSONP for? For example, white list, special domains, or something else?
Yes, you can write a server side script on your domain that will work as a bridge between your and remote domains and then send an AJAX request for your script.
Do not Expect Miracles If you do not have control over remote domains, you have been exposed. For security reasons, the restrictions you make in the browser bust you properly, you always have your own Can write a browser that does not apply this policy, but I think that you raise your issue.
Common tasks include, but they are remote domains if you do not have the control then read my previous sentence as well as my first sentence.
Here I invite you to consult which allows some common techniques to get cross domain AJAX with jQuery. Then customize one that fits your scenario best. And there is always a solution of heavy artillery that involves connecting 2 domains to server side scripts, which do bullet-proof work in 100% of cases, if any other solution does not help you.
Comments
Post a Comment