Darren
08-14-2007, 12:20 AM
I discovered Ajax a couple weeks ago and so far I'm impressed. I've been writing my own library and it seems to be working out well for me. My server side programs return an xml document and my client-side javascript parses that and takes appropriate actions. Working great so far.
I think this is pretty typical... the set up could be depicted as follows:
step 1.1 (client) ajax call using GET method -----> (server)
step 1.2 (client) <------------------- xml response (server)
As we all know, Ajax won't submit a file. So I'm going the regular form submission/response goes to hidden iframe strategy. I've written a routine that accepts the uploaded file and sends back a small html document with an onload() event to kick off the ajax submit. This currently looks like this:
step 2.1 (client) form submit using POST method -----> (server)
step 2.2 (client) <--- response via onload() in iframe (server)
step 2.3 (client) ajax call using GET method --------> (server)
step 2.4 (client) <---------------------- xml response (server)
Now the problem... or rather... what I'd like to do... is use an xml response for step 2.2 rather than the small html document. Or maybe there is a way to wrap my xml reponse up in the small html document. My goal is to be able to utilize the same function I wrote (that handles steps 1.2 and 2.4) to handle step 2.2 as well.
Any ideas?
Thanks in advance,
Darren
I think this is pretty typical... the set up could be depicted as follows:
step 1.1 (client) ajax call using GET method -----> (server)
step 1.2 (client) <------------------- xml response (server)
As we all know, Ajax won't submit a file. So I'm going the regular form submission/response goes to hidden iframe strategy. I've written a routine that accepts the uploaded file and sends back a small html document with an onload() event to kick off the ajax submit. This currently looks like this:
step 2.1 (client) form submit using POST method -----> (server)
step 2.2 (client) <--- response via onload() in iframe (server)
step 2.3 (client) ajax call using GET method --------> (server)
step 2.4 (client) <---------------------- xml response (server)
Now the problem... or rather... what I'd like to do... is use an xml response for step 2.2 rather than the small html document. Or maybe there is a way to wrap my xml reponse up in the small html document. My goal is to be able to utilize the same function I wrote (that handles steps 1.2 and 2.4) to handle step 2.2 as well.
Any ideas?
Thanks in advance,
Darren