I'm using the following code to use the return from a php

```
if (isset($_POST['P_Id'])) {
    if (!isset($_SESSION['carted_products'])) {
        $_SESSION['carted_products'] = array();
    }//end if not set products array in session

    if (!in_array($_POST['P_Id'], $_SESSION['carted_products'])) {
        array_push($_SESSION['carted_products'], $_POST['P_Id']);
        echo "success";
    }//end if not in array
    else {
        echo "already_added";
    }
}//end if not set post value
else {
    echo "fail";
}//end else

```

now in the jquery part of the calling page. I use

```
$.post(
    "add_to_cart.php",
    {P_Id:"<?php echo $row['P_Id'] ?>"},
    function(responseText){
        //if(responseText === "success"){
        //things to do on success
    }

```

but the if won't return true.

now when i check index of "already\_added" in responseText it returns 6..

why is this happening.