send datas to php with ajax - Internal Server Error(500)

Posted by user1277467 on Stack Overflow See other posts from Stack Overflow or by user1277467
Published on 2012-03-25T10:16:31Z Indexed on 2012/03/25 11:30 UTC
Read the original article Hit count: 168

Filed under:

i try to send my datas to php with ajax but there's strange mistake.

this is my ajax script,

function deleteData2()
{
    var artistIds = new Array();

    $(".p16 input:checked").each(function(){
        artistIds.push($(this).attr('id'));
    });


$.post('/json/crewonly/deleteDataAjax2', 
       { json: JSON.stringify({'artistIds': artistIds}) },
       function(response){
        alert(response);
});


}

i think this works correctly but in php side, i face 500 internal server error(500).

public function deleteDataAjax2() {

            $json = $_POST['json'];
            $data = json_decode($json);
            $artistIds = $data['artistIds'];

              $this->sendJSONResponse($artistIds);
    }

Above code is my php. For example, when i try to send $data to ajax, i print my ids in json mode:

enter image description here

However, when i try to send $artistIds to ajax side, i gives 500 error why?

© Stack Overflow or respective owner

Related posts about AJAX