I seek a simple way to call a php file using jquery.
The ultimate outcome has to do with a Magento site I am working on: http://bouquetsco.com/flowersplants.html ^^This page
This page displays products: 3 in a row.
<?php $this->setColumnCount(3); ?>
<?php $this->setColumnCount(2); ?>
^^This php code manually sets the number of product columns.
By default the page displays 3 wide, which looks fine until the browser window re-sizes down to tablet width (760px or so). When the website's design is tablet size (760px or so) I would like to display only two columns of products.
To do this, it seems one must use javascript to determine the window width, then run some php code depending on the browser-window width... like
this...
if ( browser-window-widith > 760) { get '3-column.php' }
else { get '2-column.php' }
This is grossly over-simplified. What would this code logic look like? How would one write this functionality?
Also, one could change the initial if statement to:
if (browser-window-width < 760) { get '2-column.php' }
else { get '3-column.php' }
====================================
There would exist two .php files (2-column.php, & 3-column.php) Each contains:
<?php $this->setColumnCount(2); ?>
or
<?php $this->setColumnCount(3); ?>
The code would call one file or another depending on the browser window width, (which would be found by the javascript) and thus result in
3-column product list for displays > 760px
and
2-column product list for displays < 760px
.ajax()in order to call your PHP file. However, why don't you change the columns via Javascript instead? or media queries? - Josh<?php $this->setColumnCount(2); ?>is the only thing I have found that definitely makes the changes necessary. It seems a bigger hassle to use css to change the number of columns because some php determines the number of <li>'s per <ul> on the server before it gets published. I am happy with an ajax solution, but am do not know the syntax of the code. 1. Load php, sent to browser 2. Javascript determines browser.width 3. Calls one of two php files (which respectively contain either this:<?php $this->setColumnCount(2); ?>or this:<?php $this->setColumnCount(3); ?>- Adam Caron