Having trouble running an if statement on a jquery ajax output
<p>in my check.php I have an echo "ok";</p>

<p>however my if statement to check if the value is ok does not work. 
Basically I want to execute a javascript function after check.php looks for the email in the database.</p>

<pre><code>    $.ajax({                
type: "POST",
 url: "check.php",
   data: "checkit=" + $("#checkEmail").val(),
    success: function(output){
    $("#userCheck").html(output);

            if(output == "ok"){
                alert("yay");
            }
        }


    });
</code></pre>
