The question might be a little misleading as I don't want to know how to open a html document in a div ,but I asked the question as I am currently facing a problem where I can't replace the html file which I have already placed in a div

I have already placed a html file in a div using ajax like this:

```
$.ajax({
        url: 'calender.aspx',//this is html.aspx file
        cache: false,
        dataType: "html",
        success: function (data) {
           $(".mainBar").html(data);//mainBar is the div
        }
    });

```

this file gets placed on page load i.e document.ready function ,till here everything is fine.....my trouble starts when I want to replace the file,what I do is call a javascript function say replaceFile() on button click and write the same code to replace the file (changing the url of course) 

like this

```
function replaceFile()
{
$.ajax({
        url: 'Another.aspx',
        cache: false,
        dataType: "html",
        success: function (data) {
           $(".mainBar").html(data);
        }
    });
}

```

but this doesn't work,please help me out!