QUOTE(xerxes333 @ 15 Oct, 2008 - 12:25 PM)

I didn't look into the code too much but why not just put some error checking around var product= xmlHttp.responseText.split("#"); so the browser wont error out.
Uuh i fixed the split error,but the problem is that responseText property is empty.I'm not sure whether this causes the problem but i should ask,so...
What's the difference between this:
CODE
//the functions for handling the incoming from the server data are separate functions
function retrieveProduct(productName)
{
//some code here
//parameters = blahblah;
xmlHttp.open("POST","products.php",true);
xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8;");
xmlHttp.send(parameters);
}
function doSomething()
{
//some code here
//parameters = blahblah;
xmlHttp.open("POST","products.php",true);
xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8;");
xmlHttp.send(parameters);
}
and this:
CODE
//all ''functions" for handling the incoming from the server data are inside one main function
function handleIncomingData()
{
if(something)
{
parameters = "var1=value";
xmlHttp.onreadystatechange = function() {
//do something
}
}
else
{
parameters = "var1=value";
xmlHttp.onreadystatechange = function() {
//do something else
}
}
xmlHttp.open("POST","products.php",true);
xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8;");
xmlHttp.send(parameters);
}
I mean is there some significant difference between those two methods other than just different organizing of the source code?