JSONP request on submit returns unknown variable '_'

Hello to everybody!

Before I start I would like to warn you that I am very new to Yii framework and JSONP.

I am trying to make a jsonp request to a URL on the submission of the form.

I use this code on my view file:

<?php echo CHtml::ajaxButton(‘Submit’,‘URL*’, array(

    'type' =&gt; 'GET',


    'dataType'=&gt;'jsonp',


	'data'=&gt;array('datefrom'=&gt;'js:&#036;(&#092;'#startDate&#092;').val()','dateto'=&gt;'js:&#036;(&#092;'#endDate&#092;').val()','output'=&gt;'json'),


	'callback'=&gt;'myyy',


    'url'=&gt; 'URL*',


    'success'=&gt;&quot;function(response){


        alert(response);


       }&quot;,


    )


);    

?>

Everything is right except one thing.

In firefox, i see in Web Concole that the returning URL has an unknown variable named "_".

This is what i get from Web Concole : "[13:09:31.764] GET "URL*?callback=jQuery17209786825307195876_1346839762151&datefrom=01-09-2012&dateto=04-09-2012&output=json&_=1346839771757" [HTTP/1.1 400 Bad Request 383ms]"

if i remove this part "&_=1346839771757" everything works fine.

But i cannot find where this comes from.

I cannot post the exact URL because this is my first post that’s why i have placed a URL* instead.

Any help would be very much appreciated.

Thanks in advance.

I am really sorry this is my first time I write a post to a forum (yes it’s true) so here is the code again.

In it’s right form…


<?php echo CHtml::ajaxButton('Submit','URL*', array(

'type' => 'GET',

'dataType'=>'jsonp',

'data'=>array('datefrom'=>'js:$(\'#startDate\').val()','dateto'=>'js:$(\'#endDate\').val()','output'=>'json'),

'callback'=>'myyy',

'url'=> 'URL*',

'success'=>"function(response){

alert(response);

}",

)

);

?> 



thanks again!!

OK after a lot of googling I found out what the problem was and it is not a yii problem or issue.

The unknown "_" variable is the timestamp that is automatically created by jquery and you can get rid of it if you set cache : true.

My working code know is :


<?php //echo CHtml::submitButton('Αναζήτηση'); ?>

<?php echo CHtml::ajaxButton('Submit','http://opendata.diavgeia.gov.gr/api/decisions', array(

        'type' => 'GET',

        'dataType'=>'jsonp',

		'data'=>array('datefrom'=>'js:$(\'#startDate\').val()','dateto'=>'js:$(\'#endDate\').val()','output'=>'json'),

		'jsonp'=>'callback',

		'jsonpCallback'=>'sofia',

		'cache'=>'true',

        'url'=> 'http://opendata.diavgeia.gov.gr/api/decisions',

        'success'=>"function(response){

            alert(response);

           }",

        )

    );    

?> 	

The Web concole response is finally: http://opendata.diavgeia.gov.gr/api/decisions?callback=sofia&datefrom=01-09-2012&dateto=04-09-2012&output=json