in order to increase my site’s loading times and as a nice addition, I decided to implement AJAX page loading using the jQuery function $.get.
I was pleased to see that, just as I had expected, the content that was the same across two sites remained static while only the different part was loaded.
However, now I am wondering: When $.get fetches a new page that also includes scripts and stylesheets, but when those are the same to the previous page, does the browser still send a new HTTP Request for those elements? If it did, that would sort of ruin the purpose of the feature.
Thanks!
Caching works in the same way for resources referenced by adding elements to an existing page as it does for those referenced by loading a new page with those elements in it. So it won’t make any difference.
That said, if you are loading the whole page via Ajax (as your mention of scripts and stylesheets suggests you are), then you aren’t going to save yourself any time, since you aren’t reducing the amount of data being transfered. That is only going to make a difference if you are loading (relatively) small parts of a page.