user1501754
user1501754

Reputation: 13

When I change the content of div, the div stay with the old content

I'm uploading a different files into one div,

and the div does not refresh' it stay all the time with the same content.

Here is my code:

ASPX

<div id="txtHazara"></div>

jQuery code:

if(user=="Manager")
   $('#Div1').load('Manager.aspx');
else
   $('#Div1').load('Secretary.aspx');


Any suggestion?

Upvotes: 0

Views: 61

Answers (3)

Nono
Nono

Reputation: 7302

Try this:

First clear your div content

<div id="txtHazara"></div>

jQuery Script:

if (user == "Manager") {
    $('#txtHazara').html('').load('Manager.aspx');      
} else {
    $('#txtHazara').html('').load('Secretary.aspx');        
}

Upvotes: 0

Nishu Tayal
Nishu Tayal

Reputation: 20860

Id is : "txtHazara", So your code should be like this :

if(user=="Manager")
   $('#txtHazara').load('Manager.aspx');
else
   $('#txtHazara').load('Secretary.aspx');

Upvotes: 0

maketest
maketest

Reputation: 291

Your jquery code use wrong div id.

jquery code:

if(user=="Manager")
   $('#txtHazara').load('Manager.aspx');
else
   $('#txtHazara').load('Secretary.aspx');

Upvotes: 3

Related Questions