Ajax and HTTPs Problem


I am loading some html code via Ajax on an HTTPS page.

The Problem is that to the scripts url included in the html page is added the domain name twice which results in broken URLs.

in the response included script tag:

 <script type="text/javascript" src="/assets/7a4a3a2c/gridview/jquery.yiigridview.js" > < /script >

the GET request from the browser:


should be:


Is the URL overwritten by some js script or by the browser and why?

The domain name is the same, this is not cross domain.

With http everything is working fine.

  • had to replace slash in the url backslash


Hi laadev

Please post the code of the ajax request and the part code of the CGridView in your view file.

Did you have the same problem in http protocol?


this problem does not appear with HTTP, only with HTTPS.

it does not really matter which js file, it is enough to echo a script tag with URL in the action to get this behaviour.

i use a ajaxlink looks like that:

echo CHtml::ajaxLink(




                'beforeSend' => 'function(event, elem) {

                    var sortData = $("#sortForm").serialize();

                    this.url += "&" + sortData;

                    this.url += "&ajax=true";



                'success'   => 'function(response) {





                'style'     => "float: right;margin-right:10px;",

                'class'     => 'btn btn-success',




Xm, did you try to send by url the same request ?

Copy the link that you call by ajax and open a new browser tab,

if you have the same result you have check the requested action otherwise something wrong in the ajax call

Check also (and post it here) your form paramters, i think that something wron with slash.

Also add relative or even better absolute path to the buggy urls.

for example use <?php echo $this->baseUrl ?>/assets/…/… instead /assets/…/… or assets/…/…

Let me know about the results!


this is how the script tag looks in the Ajax Response

 <script type="text/javascript" src="/assets/7a4a3a2c/gridview/jquery.yiigridview.js" > < /script >

GET from Browser


I tried with absolute paths

like that

 <script type="text/javascript" src="https:\\domain/assets/7a4a3a2c/gridview/jquery.yiigridview.js" > < /script >

GET from Browser


there is no difference between absolute and relative paths

I am just doing smt like that in the Controller at the end of the action.

echo  '<script type="text/javascript" src="https:\\domain/assets/7a4a3a2c/gridview/jquery.yiigridview.js"></script>';

I don’t understand where the “https:\\domain/site.php/” and “?_=1442334146191” is coming from, has to be from some JS Lib, no?

The Browser should not add a time stamp at the end of the URL.

Is it possible to hijack the script loading mechanism or change the script tag src before the loading happens via JS?

thank you for your help