Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Apr 2009
    Posts
    4
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Cool Using AJAX to open php breaks my Jquery

    php page being loaded

    Page using ajax to load 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 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:

    Code:
    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")

  • #2
    New to the CF scene
    Join Date
    Apr 2009
    Posts
    4
    Thanks
    2
    Thanked 0 Times in 0 Posts
    could someone please help me?


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •