发送所有信息到ajax

i try to send all checkbox data to my ajax.What i want is that

enter image description here

If user click 2 or checkbox to send my ajax and ajax call a php code. First of all,

In my view file: This is the code. Dont worry about {literal} its template_lite

  <a style="float: right" href='javascript:void(null);' onclick="deleteData2('PERSON_MOVIE',
                    {literal}{{/literal}
                        'MOVIE_ID':'{$movieId}','PERSON_ID':'{$mCast.id}','JOB_ID':'374'
                    {literal}}{/literal}
                );" ><input type=checkbox name="checkArtist[]"></a>

This my ajax

function deleteData2($table,$cols,$image)
{
     if (!$image) $image = false;
    $sendData = {
        'table':$table,
        'cols':$cols,
        'image':$image
    }

    $.post('/json/crewonly/deleteDataAjax2', $sendData, 
        function($data,$status){
            if($status=='success')
            {
                window.location.replace(window.location.pathname);
            }
        },'json');



}

How can i send array data to this ajax ?

Create the parameters as Object.

var objParams = new Object();
objParams.anarray = new Object();
objParams.anarray.table = $table;
objParams.anarray.cols = $cols;

$.post('/json/crewonly/deleteDataAjax2',
    objParams,
    function(data) {

    }
);

In your controller, the $_POST['anarray'] will contain the associative array.

So you can access table as $_POST['anarray']['table'].

As I mentioned in the previous comment, I would've gone a different route. I would enclose the form with a (well) form tag and use this code to get the data:

function deleteData2() {

    var post_data = $('form').serialize();

    $.post('/json/crewonly/deleteDataAjax2', post_data, function() {

    });
}

Then you can access the data via $_POST on PHP.