How To Work This Code?


(Rajkumar000000) #1

hi friends…

i want to know that how to work the below code?




$('.categoryFilter').change(function(){

    category = $('.categoryFilter').serialize();

    $.fn.yiiListView.update(

        'ajaxListView',

        {data: category}

    );

});



this code taken from this link.

pls explain the working of this code?

thanks


(Claudio Pascual) #2

That code is calling the [color="#0000FF"]update()[/color] method from [color="#0000FF"]yiiListView[/color] jQuery plugin whenever any element with class categoryFilter changes (f.e. select inputs).

The [color="#0000FF"]serialize()[/color] jQuery method takes all data from those inputs and converts them to an encoded query string, suitable for sending the data with an HTTP request.

As for the parameters in the update() call, [color="#0000FF"]ajaxListView[/color] is the ID of the list view container; and the second is the options map, i.e. the AJAX request options (see jQuery.ajax API manual).

Hope it helps.


(Rajkumar000000) #3

thanks clapas…