well I know it must look like a beginner question and I do hope I've missed something easy but I can't seem t find what...
I am trying to get a JSON type back but I only get the html code in return.
Here is my code, I'm not really a beginner but I am far from being a pro so I tried some testing. If i put dataType it throws me an error, even though now my code looks like this :
$("#search_ref").click(function(){
    var ref_article = $("#ref_article").val();
    $("#search_buttons").append('<button id="new_search" type="button" class="btn btn-warning"><span class="glyphicon glyphicon-search"></span> Nouvelle recherche</button>');
    $("#search_ref").remove();
    $(".construct_delete").remove();
    nb_elements = 1;
    size = 20;
    $.ajax({
        url : 'search_ref.php',
        type : 'POST',
        data : 'ref_article=' + ref_article,
        success : function(response){
            alert(response);
            console.log(response);
            var table_construct = JSON.parse(response);
            alert(table_construct);
        },
        error : function(){
            alert("Error durant \"search_ref\"");
        }
    });
})
And the other part:
<? 
$banane = [1, 2, 3, 4 ];
$banane = json_encode($banane);
echo $banane;
?>
This is not my final code but I don't get why this isn't working, how can I force the JSON data instead of the html ?
Here is what I tried : dataType:JSON, setting the second php page doctype to JSON ?,
The message of the alert is this now:
( ! ) Parse error: syntax error, unexpected '$banane' (T_VARIABLE) in C:\wamp64\www\StageNeyret\search_ref.php on line 5
