hi guys,
I'm new to ajax and i'm just following the examples from tizag and w3schools. Apparently, an application i'm trying to build is showing very peculiar behaviour.
I have a <span> section where it'll actually list out all my subject titles dynamically after a record has been inserted. However, it doesn't always list out all items with the latest added subject.
BUT
if i put an alert() before it loads the list, i won't have this problem! What's going on? is alert triggering something ? a state on ajax?
I'm using oracle 9, IE 7 and Firefox 2.
below is my ajax code that actually works.
[PHP]
function loadSubjectList (){
try
{
var xmlHttp = GetXmlHttpObjec t();
var url = null;
var param = null;
xmlHttp.onready statechange=fun ction()
{
if(xmlHttp.read yState==4)
{
document.getEle mentById('subje ctList').innerH TML=xmlHttp.res ponseText;
}
}
alert('Ahh!'); //need this to make below refresh 100%
url = "noteAction.php ";
xmlHttp.open("P OST", url, true);
xmlHttp.setRequ estHeader('Cont ent-Type','applicat ion/x-www-form-urlencoded');
param = 'F_CALL=GETSUBJ ECTLIST';
xmlHttp.send(pa ram);
}
catch(e){
alert("Failed to load." + e.message);
}
}
[/PHP]
I'm new to ajax and i'm just following the examples from tizag and w3schools. Apparently, an application i'm trying to build is showing very peculiar behaviour.
I have a <span> section where it'll actually list out all my subject titles dynamically after a record has been inserted. However, it doesn't always list out all items with the latest added subject.
BUT
if i put an alert() before it loads the list, i won't have this problem! What's going on? is alert triggering something ? a state on ajax?
I'm using oracle 9, IE 7 and Firefox 2.
below is my ajax code that actually works.
[PHP]
function loadSubjectList (){
try
{
var xmlHttp = GetXmlHttpObjec t();
var url = null;
var param = null;
xmlHttp.onready statechange=fun ction()
{
if(xmlHttp.read yState==4)
{
document.getEle mentById('subje ctList').innerH TML=xmlHttp.res ponseText;
}
}
alert('Ahh!'); //need this to make below refresh 100%
url = "noteAction.php ";
xmlHttp.open("P OST", url, true);
xmlHttp.setRequ estHeader('Cont ent-Type','applicat ion/x-www-form-urlencoded');
param = 'F_CALL=GETSUBJ ECTLIST';
xmlHttp.send(pa ram);
}
catch(e){
alert("Failed to load." + e.message);
}
}
[/PHP]
Comment