PDA

View Full Version : Dynamic Ajax Content



stebut07
08-06-2007, 03:01 PM
1) Script Title: Dynamic Ajax Content

2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...jaxcontent.htm

3) Describe problem:

Hi all,

Firstly thanks for looking at thread. I have added this script to a website. It works fine on firefox, but content not loading on IE7 and get error message with IE6. I've removed the loadobgs functions as this was not needed. You can view page at http://www.paragon-sci.com/ecommerce/general-purpose-viscosity-p-79.html

user: paragon
pass: scientific

javascript:

<script type="text/javascript">

/***********************************************
* Dynamic Ajax Content- Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

var bustcachevar=1 //bust potential caching of external pages after initial request? (1=yes, 0=no)
//var loadedobjects=""
var rootdomain="http://"+window.location.hostname
var bustcacheparameter=""

function ajaxpage(url, containerid){
var page_request = false
if (window.XMLHttpRequest) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
}
catch (e){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false
page_request.onreadystatechange=function(){
loadpage(page_request, containerid)
}
if (bustcachevar) //if bust caching of external page
bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()
page_request.open('GET', url+bustcacheparameter, true)
page_request.send(null)
}

function loadpage(page_request, containerid){
if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
document.getElementById(containerid).innerHTML=page_request.responseText
}


</script>

Link to load content is in .php

$link = "javascript:ajaxpage('" . tep_href_link('product-details2.php', 'products_id=' . $listing['products_id']). "', 'product-holder');";

$lc_text = '&nbsp;<a href="' . $link . '">' . $listing['products_name'] . '</a>&nbsp;';

I look forward to reply. Thanks in advance for help and advice given, thanks.