ShawnMolloy
MIS
I wrote this fairly straightfoward ajax call, but the http.readyState never seems to reach 4 or http.status is never 200.
There are two function calls, neither of them work:
I downloaded FIREBUG and its a great debugging tool but I can't figure out how to inspect the incomoing and outgoing http calls.
Thank yoU!!
Shawn Molloy
Seattle, WA
There are two function calls, neither of them work:
Code:
var http = createRequestObject();
function createRequestObject()
{
var xmlhttp;
try
{
xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e)
{
try { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
catch(f) { xmlhttp=null; }
}
if(!xmlhttp&&typeof XMLHttpRequest!="undefined")
{
xmlhttp=new XMLHttpRequest();
}
return xmlhttp;
}
function sndRating(idnum,rateval)
{
var dvelement = document.getElementById('dv'+idnum);
dvelement.innerHTML = "<img src='[URL unfurl="true"]http://wisetopic.com/_inc/starrating/progressimgred.gif'>";[/URL]
try
{
http.open('GET', '[URL unfurl="true"]http://localhost/wt_dev/_inc/starrating/ratingprocess.aspx?id='+idnum+'&rateval='+rateval,[/URL] true);
http.onreadystatechange = handleResponseText;
http.send(null);
}
catch(e){}
finally{}
}
function sndComment(idnum,comment)
{
var dvelement = document.getElementById('dv_Comment');
dvelement.innerHTML = "<br><div style='color: black; padding: 10px; margin: 10px; font-color: black;'><br>Adding Comment<br><img src='[URL unfurl="true"]http://wisetopic.com/_inc/starrating/progressimgred.gif'></div>";[/URL]
try
{
http.open('GET', '[URL unfurl="true"]http://localhost/wt_dev/settings/video/addComment.aspx?id='+idnum+'&comment='+comment,[/URL] true);
http.onreadystatechange = handleCommentResponse;
http.send(null);
}
catch(e){}
finally{}
}
function handleCommentResponse()
{
if((http.readyState == 4)&& (http.status == 200))
{
var dvelement = document.getElementById('dv_Comment');
dvelement.innerHTML = "Your comment has been added.";
}
}
function handleResponseText()
{
try
{
if((http.readyState == 4)&& (http.status == 200))
{
var response = http.responseText;
var update = new Array();
if(response.indexOf('|') != -1)
{
update = response.split('|');
var drelement = document.getElementById('dv'+update[0]);
var voteres = document.getElementById('vot'+update[0]);
var totalvote = document.getElementById('tv'+update[0]);
var starimg = document.getElementById('star'+update[0]);
drelement.style.display ='none';
voteres.innerHTML = update[2];
totalvote.innerHTML = update[3];
starimg.innerHTML = update[4].toString();
}
}
}
catch(e){alert("an error occured");}
finally{}
}
I downloaded FIREBUG and its a great debugging tool but I can't figure out how to inspect the incomoing and outgoing http calls.
Thank yoU!!
Shawn Molloy
Seattle, WA