CodeIgniter Forums
[SOLVED] jquery $.get - IE7 gets wrong value - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: [SOLVED] jquery $.get - IE7 gets wrong value (/thread-31361.html)



[SOLVED] jquery $.get - IE7 gets wrong value - El Forum - 06-16-2010

[eluser]SPeed_FANat1c[/eluser]
Hi,

it is strange problem. Here is simple jquery code:

Code:
$(document).ready(function(){
        var base_url = '<? echo base_url() ?>';
        
        
        $.get(base_url+"admin_/reklama/head_ad_id/", function(h_id){
            
            $('#up_' + h_id).hide();
        })
        
        $.get(base_url+"admin_/reklama/underpart_ad_id/", function(u_id){
            
            $('#down_' + u_id).hide();
        })
        
    });

and there is the function which is called by jquery:

Code:
function head_ad_id()
    {
        $query = $this->db->select('rek_id')->where('queue',1)->get('reklama');
        $row = $query->row();
        $id = $row->rek_id;
        echo $id;
    }

How can IE get diferent id from this function? Firefox, opera, chrome gets the correct value. Sometimes IE gets correct value, sometimes not.

Edit:
After I restart IE and go to the same page, it gets correct value. So maybe it somehow remembers that value from earlier, because I do this - load the page on IE and firefox. Then I click a button in firefox so it make changes in database. Then I refresh the page in IE to see if something changed - some content I can see is changed so the whole page isn't in them memory, but that value from $.get insn't and it hides the wrong button.


[SOLVED] jquery $.get - IE7 gets wrong value - El Forum - 06-16-2010

[eluser]Hernando[/eluser]
I think that IE is caching the call. Use post or append some random string to url:

base_url+"admin_/reklama/head_ad_id?random="+random_string

Greetings


[SOLVED] jquery $.get - IE7 gets wrong value - El Forum - 06-22-2010

[eluser]SPeed_FANat1c[/eluser]
Thanks, I added random string and that works Smile