Yii + BBQ + AJAX renderPartial = url issues

I’m building a site in Yii, and implemented jQuery-bbq and ajax renderpartial properly. But the only issue is that the URL gets set to domain.com/!#url=/page. I’ve been trying to remove the “url=” part for days to no avail.

Would greatly appreciate some help on this. Thank you!

Code for hashchange and links:


    // Enable "AJAX Crawlable" mode.

    $.param.fragment.ajaxCrawlable( true );

    // handling links and forms


    $("a:not(.direct)").live("click", function(){   

                    var href= $(this).attr("href");

                    if(href=="#")

                        return false;   

                    $.bbq.pushState({url:href});  


                    return false;

                  });




                  $("form:not(.direct)").live("submit", function(){

                        var url = "";


                        var type = jQuery(this).attr("method");


                        if(type==undefined)

                                type = "get";


                        if(type=="get") {


                                var action = jQuery(this).attr("action");

                                if(action.indexOf("?")==-1)

                                        url = action + "?" + jQuery(this).serialize();

                                else 

                                        url = action + "&" + jQuery(this).serialize();


                                $.bbq.pushState({ url: url});


                        } else {

                                jQuery.ajax({

                                        type:"post",

                                        data:$(this).serialize(),

                                        url:jQuery(this).attr("action"),

                                        success:applychanges

                                        });

                                }   




                        return false;

                  })




           $(window).bind( "hashchange", function(e) {  

                var url = $.bbq.getState( "url" );   

                   if(!url)

                        return;


                    $("a").each(function(){

                      var href = $(this).attr( "href" );

                      if ( href === url ) {

                        $(this).addClass( "current" ); $(this).parent("li").addClass( "active" );


                      } else {

                        $(this).removeClass( "current" ); $(this).parent("li").removeClass( "active" );

                      }

                    });


                                jQuery.ajax({

                                        type:"get",

                                        url:url,

                                        success:applychanges


                                });


                  });


                  $(window).trigger( "hashchange" );



Code for Controller.php


public function render($file, $params = array(), $data=array()) {


    if(Yii::app()->request->isAjaxRequest){


        if(Yii::app()->user->hasFlash('updatedata')) {

            $flashdata = Yii::app()->user->getFlash('updatedata');      

            $data = $data + $flashdata; 

        }




        $data['#content'] = parent::renderPartial($file, $params, true);

        $data['title'] = CHtml::encode($this->pageTitle);


        header('Content-type: text/x-json');

        echo CJSON::encode($data);

        Yii::app()->end();


    } else {            

        echo parent::render($file, $params, true);  

    }   


}


public function redirect($url,$terminate=true,$statusCode=302) {


    if(is_array($url) && isset($url[0]))

        $url = $url[0];


    if(Yii::app()->request->isAjaxRequest){


        $data = array();


        if(Yii::app()->user->hasFlash('updatedata')) {

            $flashdata = Yii::app()->user->getFlash('updatedata');      

            $data = $data + $flashdata; 

        }


        $data['#content']= '<script type="text/javascript">


            jQuery.ajax({

                url:"'.$url.'",

                type:"get",

                success:applychanges

            });


        </script>';





        header('Content-type: text/x-json');

        echo CJSON::encode($data);

        Yii::app()->end();


    } else {

        parent::redirect($url);

    }

}


public function refresh($terminate=true,$anchor='') {

    if(Yii::app()->request->isAjaxRequest){


        $data = array();


        if(Yii::app()->user->hasFlash('updatedata')) {

            $flashdata = Yii::app()->user->getFlash('updatedata');      

            $data = $data + $flashdata; 

        }




        $data['#content']= '<script type="text/javascript">

        var url = $.bbq.getState( "url" );


        jQuery.ajax({

                url:url,

                type:"get",

                success:applychanges

            });


        </script>';


        header('Content-type: text/x-json');

        echo CJSON::encode($data);

        Yii::app()->end();


    } else {

        parent::refresh();

    }

}