Hello, I have spent 4 days on my problem:
I have an online add TO Basket page where I see some products in php and MySql database.
Now I've implemented Ajax.
I have an ajax and javascript code that when I submit a product form, inserts a product in my basket (on the right of page.
It works fine in Firefox but not in explorer, and I answer to know WHY???
this is my ajax code:
function objetoAjax(){
var xmlhttp=false;
try {
xmlhttp = new ActiveXObject("Msxml2.XMLH
TTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.X
MLHTTP");
} catch (E) {
xmlhttp = false;
}
}
if (!xmlhttp && typeof XMLHttpRequest!='undefined
') {
xmlhttp = new XMLHttpRequest();
}
return xmlhttp;
}
function enviarDatosEmpleado(){
divResultado = document.getElementById('r
esultado')
;
id=document.frmempleado.id
.value;
color=document.frmempleado
.color.val
ue;
talla=document.frmempleado
.talla.val
ue;
cantidad=document.frmemple
ado.cantid
ad.value;
marca=document.frmempleado
.marca.val
ue;
artId=document.frmempleado
.artId.val
ue;
pid=document.frmempleado.i
d.value;
ajax=objetoAjax();
ajax.open("POST", "actu_Carrito.php",true);
ajax.onreadystatechange=fu
nction() {
if (ajax.readyState==4) {
divResultado.innerHTML = ajax.responseText
}
}
ajax.setRequestHeader("Con
tent-Type"
,"applicat
ion/x-www-
form-urlen
coded");
ajax.send("id="+id+"&color
="+color+"
&talla="+t
alla+"&can
tidad="+ca
ntidad+"pi
d="+pid+"m
arca="+mar
ca+"artId=
"+artId)
}
In this page you can see my web application:
http://www.merc-barcelona.com/proves/mig.php?start=0&marca=27&artId=15&pid=486
When a submit the form I call the function 'enviarDatosEmpleado()' that inserts a cell in a mysql table and show again the basket.
I have this code into a page included into a php.
I can post the rest of the code for anyone who need it.
Thnks a lot.
Jordi
Barcelona
Our community of experts have been thoroughly vetted for their expertise and industry experience.