views:

228

answers:

1

Hey, I'm doing this project where we are supposed to connect a javascript client side application/web page on server A with a python server side script on server B.

I need to get the output from the python script and store it into a variable but am running into some problems. I was trying to use XMLHttpRequest for this, and even though I managed to establish the connection the return value from the script is always "", an empty string, and it shouldn't be.

Does anyone know what the issue might be here and how to solve it?

P.S. I've been hinted that it might have something to do with cross-server scripting security or something like that, I'm not sure if that helps.

Thanks

EDIT: I've changed to jQuery, which seems simpler. Apparently the problem really is teh cross-server (I've managed to get the data if the script is in the same server) security or permissions within the web-browser (Firefox).. Anyone knows a way around this?

EDIT2: We managed to solve it using JSON... thanks for the replies anyway!

+3  A: 

It sounds like your XMLHttpRequest is failing because you're trying to do a cross-domain request. You could use a cross-domain solution like JSONP instead.

In general, tools like Firebug net panel are really useful for debugging these types of problems--you can use them to tell whether the client is sending a request correctly, and whether the server is responding correctly.

Annie