0

I use the following codes:

echo CHtml::dropDownList('book', 0, CHtml::listData($books,'id','title'),
                     array(
                        'ajax' => array(
                        'type'=>'GET', 
                        'url'=>$this->createUrl('book/allcatalog'), 
                        'data'=>array('book'=>'js:this.value'),
                        'dataType'=>'json',
                        'success'=>'js:function(data){
                            console.log(data);
                        }'
                    )));    

With firebug, I found the ajax request is that "www.xxxx.com/index.php/book/allcatalog?book=1&_=1365306810200". Why is there the parameter _=1365306810200?

hywl51
  • 551
  • 1
  • 5
  • 13

1 Answers1

3

Thanks for DCoder's help.

Finally, I find the explanation for this question from JQuery.ajax() document.

> cache (default: true, false for dataType 'script' and 'jsonp') Type: Boolean If set to false, it will force requested pages not to be cached by the browser. Note: Setting cache to false will only work correctly with HEAD and GET requests. It works by appending "_={timestamp}" to the GET parameters. The parameter is not needed for other types of requests, except in IE8 when a POST is made to a URL that has already been requested by a GET.

That is to say, the additional '_' request parameter is produced by jquery with cache=true default.

hywl51
  • 551
  • 1
  • 5
  • 13