M
Martin
Hello NG,
I've been doing some AJAX for a few weeks now. The basics worked fine so
far, but now I've got the following problem which I can't solve:
With AJAX you typically update/replace only parts of your page. But in
my application there are situation when I first notice on the server --
so AFTER sending an AJAX request -- that I have to update the complete
page instead of only some parts. And what do I do now???
- Possibility 1: (That's how I do it at the moment)
I send the complete html source code to the client and do the following:
document.open();
document.write(complete_html_code);
document.close();
Basically it works, however, my page is destroyed when I press F5
afterwards. It seems like the included CSS and JS in the header are not
"loaded" correctly - even though everything looks and functions
correctly before pressing F5. Any ideas???
- Possibility 2:
For a complete update I only send the URL for the according page to the
client. On the client I extract the this URL from the received XML and
do the following: document.location.href = extractedUrl;
Even though this should work, this solution always requires two requests
- the AJAX-request and the later JS-redirect. Thats not good either...
-Possibility 3:
I'm sure that I'm not the first person having this problem. Are the any
other solutions or maybe even some kind of patters to solve my problem?
Thanks in advance,
Martin
I've been doing some AJAX for a few weeks now. The basics worked fine so
far, but now I've got the following problem which I can't solve:
With AJAX you typically update/replace only parts of your page. But in
my application there are situation when I first notice on the server --
so AFTER sending an AJAX request -- that I have to update the complete
page instead of only some parts. And what do I do now???
- Possibility 1: (That's how I do it at the moment)
I send the complete html source code to the client and do the following:
document.open();
document.write(complete_html_code);
document.close();
Basically it works, however, my page is destroyed when I press F5
afterwards. It seems like the included CSS and JS in the header are not
"loaded" correctly - even though everything looks and functions
correctly before pressing F5. Any ideas???
- Possibility 2:
For a complete update I only send the URL for the according page to the
client. On the client I extract the this URL from the received XML and
do the following: document.location.href = extractedUrl;
Even though this should work, this solution always requires two requests
- the AJAX-request and the later JS-redirect. Thats not good either...
-Possibility 3:
I'm sure that I'm not the first person having this problem. Are the any
other solutions or maybe even some kind of patters to solve my problem?
Thanks in advance,
Martin