Welcome Guest, Not a member yet? Register   Sign In
Ajax with Jquery and IE ? Bug
#1

[eluser]fuji2009[/eluser]
Hello guy i have a problem, i do a request in ajax , works in FF but ie not refresh cache, i try alert, and this works so it s a cache problem i do it :

But don t work in ie, if i logout then i log the div refresh ...


Code:
$(".chat_form .chat_submit").click(function(){
        var dataToSend = {
            'chat_message_field' : $('[name="chat_message_field"]').attr('value'),
            'username' :  $('[name="username"]').attr('value'),
            'user_login_id' :  $('[name="user_login_id"]').attr('value'),
            'user_id' :  $('[name="user_id"]').attr('value'),
            'chat_id' : $('[name="chat_id"]').attr('value')
        };
        
        var d = new Date();
        $.ajax({
            type: "POST",
            url: "<?php echo site_url("chat/index/".$username); ?>"+d.getTime(),
            data: dataToSend,
            cache: false,
            dataType: "html",
            success: function(msg){
                $('[name="chat_message_field"]').attr('value','');
                $('#chat_contain').load('<?php echo base_url().'index.php/'?>chat/affiche_chat/<?php echo $username;?>', function(){
                  
                    $('#chat_contain').scrollTop($('#chat_contain')[0].scrollHeight);
                });
            }
         });
    
        return false;
    });


Can you help me ? Thank you
#2

[eluser]InsiteFX[/eluser]
This is how I do it.
Code:
function ie_nocache()
{
    header("Expires: Tue, 20 Feb 2011 10:00:00 GMT");
    header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
    header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
    header("Cache-Control: post-check=0, pre-check=0", false);
    header("Pragma: no-cache");
}

// Example:
<?php
ie_nocache();  // disable IE caching

// your code here

InsiteFX
#3

[eluser]umefarooq[/eluser]
there is simple solution which one working with my projects, add Math.random() to your url will work IE it always generate a random number and every time IE has a different url

Code:
url: "<?php echo site_url("chat/index/".$username); ?>"+Math.random()




Theme © iAndrew 2016 - Forum software by © MyBB