Ajax and Jquery -> not working !

Ajax and Jquery -> not working !

Hi guys,

My ajax code should change some html content and then display an alert box

It should be easy but to be honest i can't understand why the lines in the "function(data, status)" are not executed

  1. $( document ).ready(function() {

        $("button:button").click(function(){

            itemAction=$(this).attr('class');

            $.post("[[~[[++ajax_page]]? &scheme=`full`]]",{

                userId: 2,
                itemId: 7,
                itemAction: itemAction,
                ajax: 1,

            }, function(data, status){

                $("#ajaxresponse").html(data['data']);   // <= this does not work
                alert('ok');   // <= this also does not work

            });

        });

    });

  1. if ($_POST['ajax'] == 1 ){

            $data["userId"]        = $_POST['userId'];
            $data["itemId"]        = $_POST['itemId'];
            $data["itemAction"]    = $_POST['itemAction'];
            $data["data"]        = $data["userId"].'-'.$data["itemId"].'-'.$data["itemAction"];

            return json_encode($data);

        }

The status code is "Success"... And here is the response that I currently get =>
  1. userId: 2<br />itemId: 7<br />itemAction: bookmark<br />ajax: 1<br />{"userId":"2","itemId":"7","itemAction":"bookmark","result":"2-7-bookmark"}

Is it normal that there is html before the json values ?

Can someone help please ?

Thank you :)