Reputation: 5219
I have a PHP web application and I want to make a comments section for the same. So, I have decided to do it this way-
Make a Python web application to store comments and retrieve comments from the BigTable. I'd make an AJAX request to store a comment (along with the comment and other parameters) and make an AJAX request to get all the comments from the BigTable in a JSON format (Is it possible to return formatted HTML directly so that I can just replace a div in the parent page which makes the request).
The problem here is that the PHP web application is running on a different domain and I am not sure whether I can make AJAX calls - does this violate the cross-domain security policy. If yes, then how does REST based APIs work - where I can make AJAX requests to and get the JSON in response.
Ideally, I'd like to return formatted HTML directly from GAE. But if that is not possible, I'm fine with returning JSON.
Can this be done? If yes, any pointers on how to make an API like this would be useful. If no, what are the workarounds?
Upvotes: 0
Views: 912
Reputation: 139
Take a look at RockWall REST API engine.
Basic useful feature list:
Upvotes: 0
Reputation: 12838
Most browsers don't permit cross-origin XHR. The general workaround for this is JSONP, which basically means using a script tag to invoke remote javascript, which passes response data into a local callback.
There's nothing App Engine-specific about this problem or solution.
Upvotes: 2