I have ajax script but it returns unexpected token *. I use ajax example from w3school.com and it different from usually. This is my script:
<script>
$("#conform").click(function ()
{
var a= $(this).closest(".col").prev().find("#prod_qty").val();
var b= $(this).prev().val();
var c= $(this).closest("#highlight_product").find("#name").val();
var d= b * c;
var e= "<?php echo $_SESSION['name'] ?>";
var f= "<?php echo $_SESSION['email'] ?>";
}
)
function buy()
{
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
{
alert ('Browser does not support HTTP Request');
return;
}
var url='buy.php?user='+e+'&email='+f+'&product='+c+'&count='+a+'&total='+d;
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open('GET',url,true);
xmlHttp.send(null);*/
}
function stateChanged()
{
if (xmlHttp.readyState==4 || xmlHttp.readyState=='complete')
{
document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
}
}
function GetXmlHttpObject()
{
var xmlHttp=null;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
//Internet Explorer
try
{
xmlHttp=new ActiveXObject('Msxml2.XMLHTTP');
}
catch (e)
{
xmlHttp=new ActiveXObject('Microsoft.XMLHTTP');
}
}
return xmlHttp;
}
I try find it in google, It says problem with dataType
, It must HTML
. But i dont know how to change it, anyone know?