I have a function that loads some content when executed ...
IE ..
function load_product (product_id) {$ .ajax ({type: 'GET', url: 'product_image.php', data: 'product_id =' + product_id + '', success : Function (data) {$ ('# Product_image') .html (data);}}); } It works great but says I want to create a link to a page, so that some dynamic content trigger to load?
IE I link to a page, say
www .blah.com /? Product = 1 and some 'divs' on the page that dynamically loads various things for product # 1.
The way I am currently doing something:
And I said that somewhere new page is loading. It works. But is there a better way?
I do something similar but I am using it.
& lt; Script & gt; Var isProduct = & lt ;? Php echo release ($ _ [request ['product'])? 'True': 'False'? & Gt; Yoppop ({test: isproduct, yes: 'js_file_to_load.js',}); & Lt; / Script & gt; Then you can store all JS in an external file. There is additional benefit on your method in this, I do not need to load external scripts for each request when $ _ REQUEST ['product'] is set.
Comments
Post a Comment