...

View Full Version : Using AJAX to open php breaks my Jquery



mastertommyg
07-14-2009, 10:29 AM
php page being loaded (http://ivgarb.com/newWebby/item3.php?iid=20)

Page using ajax to load php (http://ivgarb.com/newWebby/index.php)

I have two pages:

index.php is using XMLHttpRequestObject.open("GET", dataSource); to open item3.php?iid=20 and put the content into div id="main"

the problem is that my jquery image gallery breaks after index.php loads the page, and the images are loaded into a new window instead of popping into the h2 tag like they're supposed to.

if you go to the php page being loaded (http://ivgarb.com/newWebby/item3.php?iid=20) you can see how the image gallery is supposed to behave

I tried using a php include function to no avail. any help would be appreciated.

the switcharoo.js:



var XMLHttpRequestObject = false;

if (window.XMLHttpRequest) {
XMLHttpRequestObject = new XMLHttpRequest();
} else if (window.ActiveXObject) {
XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP");
}

function getProduct(dataSource, divID)
{

if(XMLHttpRequestObject) {
var obj = document.getElementById(divID);
XMLHttpRequestObject.open("GET", dataSource);
XMLHttpRequestObject.setRequestHeader("Content-type", "text/xml");

XMLHttpRequestObject.onreadystatechange = function()
{
if (XMLHttpRequestObject.readyState == 4 &&
XMLHttpRequestObject.status == 200) {
obj.innerHTML = XMLHttpRequestObject.responseText;
}
}

XMLHttpRequestObject.send(null);


}
}

$(document).ready(function(){

$("h2").append('<em></em>')

$(".thumbs a").click(function(){

var largePath = $(this).attr("href");
var largeAlt = $(this).attr("title");

$("#largeImg").attr({ src: largePath, alt: largeAlt });

$("h2 em").html(" (" + largeAlt + ")"); return false;
});

});

alert("HI")

mastertommyg
07-14-2009, 06:59 PM
could someone please help me?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum