Hello, I've looked all over the web but can't find a solution. 1st I finally found a way to stop my memory leaks thanks to a guy having the same problem here on stackoverflow (and the guy who wrote the script). Now this memory leak fix is creating another problem for me.
My members list is called via ajax using the fix. But I have a tooltip on the members page the fix is calling. NOTHING jquery works on the page the fix is calling, I've tried everything.
Here's the fix to stop my memory leaks.
<script type="text/javascript">
/**
* @filename JsAjax.js
* @author Raju Gautam
* @version 0.1
* @copyright Copyright (c) 2007, Author Raju Gautam
* @package AJAX Collection
* @date Dec 31, 2007
**/
/* Loading script */
var strLoading = '<div style="padding:2px;color:#FF0000;height:100%"></div>';
/****************** AJAX GET Start **************************/
/*
* This is the function to send the request to the server
* @author Raju Gautam
* @version 0.1
* @copyright Copyright (c) 2007, Raju Gautam
* @date Dec 31, 2007
**/
function sendGetRequest(para_url, contentDiv, divLoading){
var url = "";
var xmlHttp = GetXmlHttpObject();
if(para_url.indexOf('?')) url = para_url + "&rand=" + Math.random();
else url = para_url + "?rand=" + Math.random();
xmlHttp.onreadystatechange = function(){
afterStateChange(xmlHttp, contentDiv, divLoading);
}
xmlHttp.open("GET", url, true);
xmlHttp.send(null);
}
/* This is the function to used to show the response text from server
* @author Raju Gautam
* @version 0.1
* @copyright Copyright (c) 2007, Raju Gautam
* @date Dec 31, 2007
**/
function afterStateChange(xmlHttp, contentDiv, divLoading){
if(xmlHttp.readyState < 4){
showLoading('On', contentDiv, divLoading);
}
if(xmlHttp.readyState == 4 || xmlHttp.readyState == "complete"){
showLoading('Off', contentDiv, divLoading);
document.getElementById(contentDiv).innerHTML = xmlHttp.responseText
}
}
/* This is the function to show/hide the loading message
* @author Raju Gautam
* @version 0.1
* @copyright Copyright (c) 2007, Raju Gautam
* @date Dec 31, 2007
**/
function showLoading(flag, contentDiv, divLoading){
if(divLoading != ''){
var objLoading = document.getElementById(divLoading);
if(!objLoading) var objLoading = document.getElementById(contentDiv);
/* if(flag == 'On') objLoading.innerHTML = strLoading;
else if(flag == 'Off') objLoading.innerHTML = '';*/
}
}
/*
* This is the function to create a new XML HTTP object GET Request
* @author Raju Gautam
* @version 0.1
* @copyright Copyright (c) 2007, Raju Gautam
* @date Dec 31, 2007
**/
function GetXmlHttpObject(){
var xmlHttp;
try{
/* Firefox, Opera 8.0+, Safari */
xmlHttp = new XMLHttpRequest();
}
catch (e){
/* Internet Explorer */
try{
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e){
try{
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e){
alert("Your browser does not support AJAX!");
return false;
}
}
}
return xmlHttp;
}
/****************** AJAX GET End **************************/
var second = 0;
var limit = 15;
function display2(){
if (second == limit){
var rand = new Date().getTime();
var myVal = '1';
sendGetRequest('allonline.php?rand='+rand, 'scontent', 'scontent');
second = 0;
}
second += 1;
setTimeout("display2()", 1000);
}
display2();
</script>
by now I can't get the jquery tool qtips tooltip (or any script) to work in the allonline.php page using this script.
<script type="text/javascript">
// Create the tooltips only on document load
$(function()
{
// Use the each() method to gain access to each elements attributes
$('#content6 a[rel]').each(function()
{
$(this).qtip(
{
content: {
// Set the text to an image HTML string with the correct src URL to the loading image you want to use
url: $(this).attr('rel'), // Use the rel attribute of each element for the url to load
title: {
text:$(this).text(), // Give the tooltip a title using each elements text
button: '' // Show a close link in the title
}
},
position: {
corner: {
target: 'leftMiddle', // Position the tooltip above the link
tooltip: 'rightMiddle'
},
adjust: {
screen: false // Keep the tooltip on-screen at all times
}
},
show: {
when: 'mouseover',
solo: true // Only show one tooltip at a time
},
hide:'mouseout',
style: {
tip: true, // Apply a speech bubble tip to the tooltip at the designated tooltip corner
border: {
width: 5,
radius: 10
},
padding: 10,
name: 'blue', // Use the default light style
width: 650 // Set the tooltip width
}
})
});
});
</script>