Welcome to WebmasterWorld Guest from 107.20.75.63

Forum Moderators: open

Message Too Old, No Replies

Developing Javascript webpage with non-javascript alternative

     
12:33 pm on Feb 15, 2012 (gmt 0)

New User

joined:Aug 15, 2011
posts: 26
votes: 0


I've redeveloped a webpage where previously all the page layout and search results were generated in PHP on the server and then displayed on the page when they were complete. This was slow.

To improve performance and responsiveness the new version loads the header/footer only for the page and then creates the remaining layout with javascript before populating the results dynamically using AJAX requests.

The downside of this is that obviously the page doesn't load properly without javascript support. What I'm trying to do is find a way of falling back on the old PHP code for layout & results if javascript is not enabled.

I've tried adding the old code into my new page and in a non-javascript browser it is fine. However in a javscript browser it loads everything twice - using the new javscript layout & results code and the old php code.

Because the PHP code is executed before the javscript code I can't see anyway to avoid this. Am I missing something completely here?

Thanks for any guidance.