Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

Ajax doesn't work when I run few AJAX events

6:01 pm on Nov 2, 2007 (gmt 0)

Junior Member

10+ Year Member

joined:Feb 28, 2004
votes: 0

Hello guys,

I'm new to AJAX and I'm trying to build feature for my website using AJAX. I have like 20 images on the page and I need to call get some info using AJAX when user put mouse over that image.

My code works, but it stops working when I put mouse over few images during 1 or 2 seconds.

My code:

var AJAX = null;
if (window.XMLHttpRequest) {
AJAX=new XMLHttpRequest();
AJAX=new ActiveXObject("Microsoft.XMLHTTP");

AJAX.onreadystatechange = function() {
if (AJAX.readyState==4 ¦¦ AJAX.readyState=="complete"){
showAjax(AJAX.responseText, AJAX.status);

function showAjax(ajaxData, serverStatus) {
document.getElementById(someDiv).innerHTML = ajaxData;

I've tried to modify function to use array, but it doesn't work too:

var AJAXphoto = Array();

function sendAjaxPhoto (photoId, photo_big){
var url='http://www.site.com/ajaxShowPhoto.php?photoId=' + photoId + '&photoBig=' + photo_big;
AJAXphoto[photoId].open("GET", url, true);

function showPhoto (ajaxData, serverStatus){
photoWindow = document.getElementById("infoWindow");
photoWindow.innerHTML = ajaxData;

big function that creates images(....){


if (window.XMLHttpRequest) {
AJAXphoto[photoId] = new XMLHttpRequest();
AJAXphoto[photoId] = new ActiveXObject("Microsoft.XMLHTTP");

AJAXphoto[photoId].onreadystatechange = function() {
if (this.readyState==4 ¦¦ this.readyState=="complete"){
showPhoto(this.responseText, this.status);


event.addListener(image, "mouseover", function() {
sendAjaxPhoto(photoId, photo_big);



Firebug (Firefox extension for JavaScript debugging) shows errors like this one when I put mouse over few images:

[Exception... "Component returned failure code: 0xc1f30001 (NS_ERROR_NOT_INITIALIZED) [nsIXMLHttpRequest.send]" nsresult: "0xc1f30001 (NS_ERROR_NOT_INITIALIZED)" location: "JS frame :: javascript: eval(__firebugTemp__); :: anonymous :: line 1" data: no]
mc(mouseout clientX=0, clientY=0, div#map)main.js (line 240)
ne(mouseout clientX=0, clientY=0)main.js (line 540)
iv(mouseout clientX=0, clientY=0)

Can you guys help me to fix it please? I'm trying to fix it for a week already, but still can't make it work.


Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members