How do I pass the correct data type to Javascript from PHP
<p>I am using the jQuery post method to create a record in MySQL. When I evaluate the output of the PHP with <code>==</code>, all three conditionals work properly. However, when I use <code>===</code>, the first two conditionals return <code>false</code>. How do I pass the correct data type to Javascript from PHP?</p>

<p>jQuery:</p>

<pre><code>$("#form").validate({

    submitHandler: function(form) {
        // do other stuff for a valid form
        $.post('inc/process_form.php', $("#form").serialize(), function(data) {
            //alert(data);
            if (data == 1) {
                $('#results').html("Success");
            } else if (data == 2) {
                $('#results').html("No Success");
            } else {
                $('#results').html(data);
            }
        });
    }
});
</code></pre>

<p>This is the PHP (which I've truncated to only show the execute conditional):</p>

<pre><code>$value = $stmt-&gt;execute();

if ($value === TRUE) {
echo 1; //success
} else {
echo 2; //failure
}
</code></pre>
