problem with AJAX

alvaroag

New Member
Messages
288
Reaction score
0
Points
0
I have a photo gallery using AJAX. When the user clicks on the photo thumbnail, the image should appear on the top of the page, inside a div writen dinamically using javascript. That works OK under Opera, Firefox, and IE7. But the problem is when using IE6. The image doesn't appears. And most of my users use IE6. Does anyone knows how to fix this? The website is http://larcenciel2006.x10hosting.com/phalbum.php?ajax=1.

Thanks

Alvaro
 
Last edited:

oab

New Member
Messages
918
Reaction score
0
Points
0
most likely your using the wrong connection
in internet explorer you have to use activex objects...
heres my function i cant remember where i got it it was a while ago.

Code:
function getHTTPObject() {
  var xmlhttp;
  /*@cc_on
  @if (@_jscript_version >= 5)
    try {
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (E) {
        xmlhttp = false;
      }
    }
  @else
  xmlhttp = false;
  @end @*/
  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
    try {
      xmlhttp = new XMLHttpRequest();
    } catch (e) {
      xmlhttp = false;
    }
  }
  return xmlhttp;
}
var http = getHTTPObject();
then just use http.open, http.send, ect.
 

alvaroag

New Member
Messages
288
Reaction score
0
Points
0
added the jscript connection part, but still it doesn't works. I works on Opera 9.02, IE 7, Firefox 2.0, and K-Meleon 1.02. But it doesnt works on IE6. The mthumbnails are shown up without problems, but when you click on an thumb it should show you the big image on the upper part, but that big image(640*480) doesn't shows up only with IE6.
 

oab

New Member
Messages
918
Reaction score
0
Points
0
add the if statement

if (AJAX_Object.readyState == 4){
}

to your function that actually diplays the image.

EDIT: nope nvm i dont think thatll make a difference sorry dude cant help you.
 
Last edited:

t2t2t

New Member
Messages
690
Reaction score
0
Points
0
I see photos after doing right-click -> show images on image space.

Maybe there is a problem with image showing?
 

oab

New Member
Messages
918
Reaction score
0
Points
0
im not sure how his display image function works but maybe try using the DOM method if you arent already.

should be able to google it.

oh wait you dont even need to use ajax to display the images, just for the comments, for the image you can just do

Code:
document.getElementById('imagediv').innerHTML = "html code to display image';

or even better use the DOM method like i mentioned before.

Code:
document.createElement(’img’);
img.src = "image.gif";
 
Last edited:

alvaroag

New Member
Messages
288
Reaction score
0
Points
0
I see photos after doing right-click -> show images on image space.

Maybe there is a problem with image showing?

I hadn't tried that before(right click->show image). that way, it works. but when i tried to make that refresh automatically, it didn't worked. thanks anyway.


im not sure how his display image function works but maybe try using the DOM method if you arent already.

should be able to google it.

oh wait you dont even need to use ajax to display the images, just for the comments, for the image you can just do

Code:
document.getElementById('imagediv').innerHTML = "html code to display image';

or even better use the DOM method like i mentioned before.

Code:
document.createElement(’img’);
img.src = "image.gif";

I don't use exactly the .innerHTML property, because of compatibility issues(not al browsers support that). instead, I use a function which selects automatically between three methods of writing a div. the innerHTML is one of them.

The DOM usage was a great idea. i'm now using it for the image showing, and it works under any navigator(IE6,IE7,Firefox 2,Opera 9, K-Meleon 1, and maybe more). I'm planning to convert the rest of the page to use DOM. It's really better than writing the HTML code directly.

thanks a lot!

Alvaro
 
Top