Jump to content

Saving an AJAX page


artacus

Recommended Posts

I am using Javascript to create the contents of a page (in this case a CSV file I want to save). If you've worked with Ajax for more than a day, you know that it modifies the DOM but the browser does not show those changes when you view source or, more important to me at the moment, save the page.

Is there some way to make the browsers save the Javascript changes instead of the original document?
Link to comment
https://forums.phpfreaks.com/topic/29455-saving-an-ajax-page/
Share on other sites

I'm not aware of a way to do this and be able to view the source via the normal "view source" options.  However, one of the browsers (I swear it was FF), allows you to highlight the changes returned by AJAX and use "view selection source" or something similar.  That will show you the result.
Link to comment
https://forums.phpfreaks.com/topic/29455-saving-an-ajax-page/#findComment-135481
Share on other sites

Yeah, FF lets you see the changes if you use 'view selection source'. But can you imagine trying to walk your typical user thru that process?

Step 1. CTRL + A To select all
Step 2. CTRL + S To save
Step 3. Save as file  with CSV extension
Step 4. Find that file and open with excel

It would result in more work orders than it would be worth.
Link to comment
https://forums.phpfreaks.com/topic/29455-saving-an-ajax-page/#findComment-135530
Share on other sites

[quote author=ober link=topic=117356.msg479149#msg479149 date=1165340010]
... why would you want your user to view your source!?!  Why wouldn't you just present a csv file to them and let them click and download it? [/quote]

That's exactly what I WANT to do. But since my data is being generated by Javascript after the page loads, it will save the file as it existed BEFORE Javascript added the data.
Link to comment
https://forums.phpfreaks.com/topic/29455-saving-an-ajax-page/#findComment-135683
Share on other sites

Its looking like I'll end up doing it in PHP. I wanted to do it with Javascript because I've already done all of the work (well PHP/MySQL has) to generate an HTML table with possibly 1,000's of records. I didn't want to waste resources doing it over again when it was so easy to convert the table to CSV. *Sigh* You win some you lose some. I'm just not accustomed to losing.
Link to comment
https://forums.phpfreaks.com/topic/29455-saving-an-ajax-page/#findComment-135736
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.