AJAX data change and send to contoller

AJAX data change and send to contoller

LNKLNK Posts: 1Questions: 1Answers: 0

Hi, all

my source,

var mainMng={

    init : function(){
        table =  $J('#myTable').DataTable({

             "iDisplayLength": 10, 
             "bPaginate":true,
             "paging": true,
              "bSort":true, 
             "pagingType": "full_numbers",
             "sPaginationType": "bootstrap",
            serverSide: true,

            ajax: ({
                url: '/chart/makeTable',
                type: 'POST',
                data: {
                    "page": $J("#page").val(),
                    "myTable_length": $J("#myTable_length").val(),
                }
            }) 
        });

} ;

...

I initialized table, and I want to send changed ajax data ( page and myTable_length) to Contorller .

so,

adding to node (jquery.dataTables.js) source ,

like
if ( btnDisplay ) {
node = $('<a>', {
'class': classes.sPageButton+' '+btnClass,
'aria-controls': settings.sTableId,
'data-dt-idx': counter,
'tabindex': settings.iTabIndex,
'id': idx === 0 && typeof button === 'string' ?
settings.sTableId +''+ button :
settings.sTableId +'
' + btnDisplay//null
,'onClick' : 'javascript:mainMng.clickPage("' + btnDisplay + '");'
,'href' : '#'
} )
.html( btnDisplay )
.appendTo( container );

                            _fnBindAction(
                                node, {action: button}, clickHandler
                            );

                            counter++;
                        }

onClick function.

In mainMng.clickPage() ;

clickPage :function(btnDispaly){
switch ( btnDispaly ) {
case 'ellipsis':
break;

        case 'first':
            break;

        case 'previous':
            break;

        case 'next':
            break;

        case 'last':
            break;

        default:
            break;
    }
        $J('#page').val(btnDispaly); 
        console.log('page : ' + $J('#page').val());


        if (typeof table == 'undefined') {
        }else{
            $J("tbody").empty();
            table.fnDraw();
        }
}

I want to change value of $J('#page').val() .

But, in contoller , page value is not change.

How to change customer form value and send to Contoller ?

This discussion has been closed.