Rickstar
Rickstar

Reputation: 6189

jQuery & PHP and MYSQL IE Problem

Now All of this code works fine in Firfox but in IE the divs dont change when the php infomation changes.

Can some one help me please as i am working on a project and this is holding me back Thank you.

Here is the jQuery Code:

$.ajaxSetup({ cache: false }); $(document).ready(function(){ $("#not").css('display','none'); $("#fonline").css('display','none'); $("#not").hide();
$("#fonline").hide();
$("#shfm").click(function () { $("#not").hide();
$("#fonline").toggle(); });

$("#notifi").click(function () { $("#fonline").hide();
$("#not").toggle(); });

});

function closeboxes() { $("#fonline").hide(); $("#not").hide(); } function loadContent(id) { $("#contentArea").load("notifications.php?o="+id+""); };

$(document).ready(function() {

$("#settings").toggle( function () { $(this).html('X Close'); }, function () { $(this).html('Settings'); } ); });

function FriendsContent(id) { $("#fArea").load("friends_online.php?fo="+id+""); };

$(document).ready(function() { $("#Options").toggle( function () { $(this).html('X Close'); },

function () { $(this).html('Options'); } ); });

var refreshId = setInterval(function() { $('#fArea').fadeOut("slow").load('response.php').fadeIn("slow"); }, 10000);

PHP Code:

$cOption = $_GET['fo'];

switch($cOption) {

case 1:
$recordsPerPage = 5; 
$pageNum = 1;

if(isset($_GET['pg'])) {
$pageNum = $_GET['pg'];
settype($pageNum, 'integer');
}

echo "<table width='98%' border='0' cellspacing='0' cellpadding='0'>";

$offset = ($pageNum - 1) * $recordsPerPage;

$onlineresult = mysql_query("SELECT * FROM online") or die (mysql_error()); 
while ($ousers = mysql_fetch_array($onlineresult)) { 
$onuid = $ousers['uid'];


$flist = mysql_query("SELECT * FROM friends_list WHERE fid='$onuid' AND uid='$myid' LIMIT $offset, $recordsPerPage;") or die (mysql_error()); 
while ($fri = mysql_fetch_array($flist)) { 
$id = $fir['id'];
$uid = $fri['uid'];
$fid = $fri['fid'];


$userinfomation = mysql_query("SELECT * FROM accounts WHERE id='$fid'");
$userinfo = mysql_fetch_array($userinfomation);
$v_tgid = $userinfo['tgid'];
 echo "
  <tr class='menutxt2'>
    <td width='11%' height='21'><center>
    </center></td>
    <td width='50%'><a href=\"javascript:void(0)\" onClick=\"javascript:chatWith('$v_tgid')\">$v_tgid</a></td>
    <td width='39%'>View Profile</td>
  </tr>
"; 
}
}

echo "</table>";
$query = "SELECT COUNT(id) AS id FROM friends_list;"; 
$result = mysql_query($query) or die('Mysql Err. 2');
$row = mysql_fetch_assoc($result);
$numrows = $row['id']; 

$maxPage = ceil($numrows/$recordsPerPage);
$nav = '';
for($page = 1; $page <= $maxPage; $page++)
{
if ($page == $pageNum)
{
$nav .= "<span class='menutxt'>Pages: $page </span>";
}
else
{
$nav .= "";
}
}

if ($pageNum > 1) {

$page = $pageNum - 1;
$prev = "";

$first = "";
}
else {
$prev = '';
$first = '';
}

if ($pageNum < $maxPage) {
$page = $pageNum + 1;
$next = "";

$last = "";
}
else {
$next = '';
$last = '';
}
echo "$first <b>$prev</b> $nav<b> $next</b> $last"; 
            echo "

";
            break;
        case 2:
            echo 'Options';
            break;
        default:
            echo 'Whoops, didn\'t understand that option: <i>'.$cOption.'</i>';
    }

Upvotes: 0

Views: 544

Answers (1)

T. Stone
T. Stone

Reputation: 19485

IE tends to cache ajax requests when you don't want it to. The .load() towards the end of your code is issuing a GET request which IE is probably caching instead of fetching from the server.

Upvotes: 2

Related Questions