Hey got a new question, thought I'd use the same thread.
I have this which loads my XML file of "Items" (Javascript)
function Ajax(){
var xmlHttp;
try{
xmlHttp=new XMLHttpRequest();// Firefox, Opera 8.0+, Safari
}
catch (e){
try{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); // Internet Explorer
}
catch (e){
try{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e){
alert("No AJAX!?");
return false;
}
}
}
xmlHttp.onreadystatechange=function(){
if(xmlHttp.readyState==4){
txt="<table border='1'><tr><th>Name</th><th>Price</th><th>Item Code</th><th>Cart</th></tr>";
x=xmlHttp.responseXML.documentElement.getElementsByTagName("item");
for (i=0;i<x.length;i++){
xx=x[i].getElementsByTagName("quantity");
if ((xx[0].firstChild.nodeValue)>0){
txt=txt + "<tr>";
xx=x[i].getElementsByTagName("name");
{
try
{
txt=txt + "<td>" + xx[0].firstChild.nodeValue + "</td>";
}
catch (er)
{
txt=txt + "<td> </td>";
}
}
xx=x[i].getElementsByTagName("price");
{
try
{
txt=txt + "<td>" + xx[0].firstChild.nodeValue + "</td>";
}
catch (er)
{
txt=txt + "<td> </td>";
}
}
xx=x[i].getElementsByTagName("itemcode");
{
try
{
txt=txt + "<td>" + xx[0].firstChild.nodeValue + "</td>";
}
catch (er)
{
txt=txt + "<td> </td>";
}
try
{
txt=txt + "<td><button>Add to cart</button></td>";
}
catch (er)
{
txt=txt + "<td> </td>";
}
}
txt=txt + "</tr>";
}
}
txt=txt + "</table>";
document.getElementById('ReloadThis').innerHTML=txt;
setTimeout('Ajax()',5000);
}
}
xmlHttp.open("GET",'data/items.xml',true);
xmlHttp.send(null);
}
window.onload=function(){
setTimeout('Ajax()',5000);
}
Which makes this:
My question is, how can it so when the button is pressed on a product "Add to cart" it automatically shows up down the bottom? Any point in the right direction would be helpful.