$(document).ready(function()... broken


I’m getting a curious bug when i click on a CSort link.

As you see in the following image, CSort returns an entire page (DOCTYPE+<html><body></body></html>) :

But this breaks all the $(document).ready(function().

To reproduce: take a page that contains CSort (a Clistview page) and add the following code on it :

<?php Yii::app()->getClientScript()->registerScript('hello',

        '$(document).ready(function() {

            alert(\'Hello world\');



Then click the sort button.

The Hello world message will not shows again but why ?

However we just received a full HTML page !

I’m using Firefox 12 on ubuntu linux (12.04 latest) and the result is the same in Opera 11.64 and the latest Chrome

Is it a bug from the browser JS engines or from JQuery or from CSort ?

Or the question should be :

Why the new document we get by ajax CSorting is not ready() ?