Welcome Guest, Not a member yet? Register   Sign In
[SOLVED] jquery $.get - IE7 gets wrong value
#1

[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.
#2

[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
#3

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




Theme © iAndrew 2016 - Forum software by © MyBB