This code is working (as is) on a live site. I am attempting to run it on localhost via XAMPP but addToCart.php is not being called.
Wondering if there’s a better way to write this so it is more robust and will work on localhost config as well. I am not very familiar with JQuery or PHP, as may be obvious from the code.
<a id="atcAnchorTag'.$thisProduct['id'].'"
href="#"
onclick="
jQuery.ajax(\'./addToCart.php?id='.$thisProduct['id'].'\');
jQuery(atcAnchorTag'.$thisProduct['id'].').hide();
jQuery(rfcAnchorTag'.$thisProduct['id'].').show();
jQuery(mt'.$thisProduct['id'].').hide();
jQuery(grn'.$thisProduct['id'].').show();
scItemsCountJS++ ;
return false ; "
style="display:'.$atcDisplayType.'">add to cart</a>
Actually, Blender was correct and I would credit him with the answer if there was a way to do so. Rewriting the code as he suggested turned out not to be very difficult but it took a long time to figure it out myself.
Here is what worked. HTML:
JQuery: