![]() |
|
|
Frustrated: AJAX Problem with IE |
|
Truth Seeker
![]() Posts: 2,191
Name: Keith Marshall
Location: West Hartford, CT
|
I am having a problem with an AJAX problem. The following example works in FireFox but not IE. I have bolded the response function in which IE will not fire, but gives me an error "Object doesn't support this property or method".
The following example can be viewed on our development server: http://66.101.212.20/~rsadmin/index.html The included javascript: Code:
var ajaxLiveHelpStatus;
function liveHelpStatus(url)
{
ajaxLiveHelpStatus = new XMLHttp();
ajaxLiveHelpStatus.sendRequest(url, null);
ajaxLiveHelpStatus.http.response = function()
{
alert(1);
if(ajaxLiveHelpStatus.http.status==200)
{
if(ajaxLiveHelpStatus.http.responseText==1)
{
document.getElementById('liveHelp').innerHTML='<a href="javascript:ShopTogether.preInitializeAndOpen(\'Customer\');">ONLINE</a>';
setTimeout('liveHelpStatus("'+url+'");', 3000);
}
else
{
document.getElementById('liveHelp').innerHTML='offlineXXX';
}
}
}
}
function XMLHttp()
{
this.createRequestObject = function()
{
var rObj = false;
if (typeof XMLHttpRequest == 'function')
{
rObj = new XMLHttpRequest();
}
else
{
var avers = ['Microsoft.XMLHTTP', 'MSXML2.XMLHTTP', 'MSXML2.XMLHTTP.3.0', 'MSXML2.XMLHTTP.4.0', 'MSXML2.XMLHTTP.5.0'];
for (var i = avers.length -1; i >= 0; i--)
{
try
{
rObj = new ActiveXObject(avers[i]);
}
catch(e) {}
}
}
if(!rObj) throw new Error('XMLHttp (AJAX) not supported');
return rObj;
}
this.sendRequest = function(url, param)
{
var method = (!param) ? 'GET' : 'POST';
self.http.open(method, url, true);
self.http.onreadystatechange = self.handleResponse;
if (method == 'POST') self.http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
self.http.send((method == 'POST') ? param : null);
}
this.handleResponse = function()
{
if ((self.http.readyState == 4) && (typeof self.http.response == 'function')) self.http.response();
if ((self.http.readyState == 1) && (typeof self.http.wait == 'function')) self.http.wait();
}
var self = this;
this.http = this.createRequestObject();
var response = null;
var wait = null;
}
Code:
<script type="text/javascript" language="javascript">liveHelpStatus("<?php echo HTTP_SERVER . DIR_WS_CATALOG; ?>livehelp_status.php");</script>
Live Help is <span id="liveHelp">offline</span>
Any suggestions as to why this backfires in IE???
__________________
<mgraphic /> - I don't have a solution but I admire the problem. |
|
|
|
| Sponsored Links (We share ad revenue): |
| Sponsored Links (We share ad revenue): |
| Thread Tools | |
|
|
| Webmaster Resources Marketplace: |
| Software Development Company | Webhosting.UK.com |
| Web Templates | Text Link Brokers | Stock Photos |