PDA

View Full Version : PHP JSP and JSONP



schla104
18 Aug 2010, 11:42 PM
So I've got two sites. One is written entirely with jsps and the other entirely with php and each is on a separate domain and each has a separate database. I've worked with both languages individually before, but never together. So here is my problem. I've got some php running a function on domain1. When this function is run and gets to a certain point, I want it to pass some information into the jsp on domain2. The jsp on domain2 runs and updates a database on domain2. I then want it to pass back a variable so that php on domain1 can then update its database accordingly.

I've been looking into jQuery and JSONPs and I think this is what I need to accomplish my goals, but I'm not entirely sure how to go about implementing it.

Here's how I understand it so far:

JSP has to output variable(data) as a JSON at the end.
PHP page uses jQuery to retrieve variable as a JSONP from the jsp.
Use PHP and returned data to update database.

If I'm wrong conceptually, please let me know.
Otherwise, I think I'm just getting really mixed up with what the code would actually look like and if someone could give me some psuedo-code or sort of walk me through in a little more detail of how one could do this, that would be great.

Any help is appreciated. Thanks