I would appreciate it if someone can point me into the right direction on this issue.
I'm trying to optimize page load speed of my OpenCart project. To do this I want to load the content of each page (product/category
, product/search
, ...) after javascript onload like this in header.twig:
window.onload = function() {
console.log('page loaded');
$.post( window.location.href, { loaded: true })
.done(function( data ) {
alert( "Data Loaded: ");
});
}
In php side I tried such a code but it's not successful at all.
if (isset($this->request->get['manufacturer_id']) && isset($_POST['loaded'])) {
...
If I want to use callback
the problem is pages are different. I don't know how to manage all pages.