wojodesign/simplecart-js — Issue #184: Help w/ AJAX loader + SimpleCart
Author: mboperator
Created: 2011-12-29 03:19:30+00:00
State: open

Hi, after a bit of searching I was unable to find a helpful post so...

My issue is that I use an ajax call to load some HTML into a lightbox:

function loadurl(str) {

try {
xmlhttp = window.XMLHttpRequest?new XMLHttpRequest(): new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {
}
xmlhttp.onreadystatechange = triggered;
xmlhttp.open("GET","productpage.php?b="+str);
xmlhttp.send();
}

function triggered() {
if ((xmlhttp.readyState == 4) && (xmlhttp.status == 200)) {
// xmlhttp.responseText object contains the response.
document.getElementById("lightphp").innerHTML = xmlhttp.responseText;
}
}

The HTML I'm using works directly and I'm able to add/remove things from the cart, but when it's loaded into the lightbox via the code above, none of the simpleCart functions work. Anyone have any advice?