How to solve [object Object] error in jquery.ajax()

I'm using the below jquery function to send data from a form and get the reply back. Below is the Jquery function I use to get the result :

    console.log( "ready!" );
            statusCode: {
                500: function() {
            url: './contact.php',
            type: "POST",
            data: {
                "name": $("#name").val(),
                "element_4_1": $("#element_4_1").val(),
                "element_4_2": $("#element_4_2").val(),
                "element_4_3": $("#element_4_3").val(),
                "email": $("#email").val(),
                "input4": $("#input4").val(),
            error: function(t){
                console.log("Error: "+t);
            success: function(data){
                $("#stage").text("Thank You");

Now The text form which is here sends the data :

<div class="col-lg-7 well">
    <h4 style="padding-top:8px;">Your email address will not be published. Required fields are marked <font color="red">*</font></h4>
    <label>Name<font color="red">*</font></label><br>
    <input class="form-control" style="height:35px;width:230px;border-radius:4px;" required type="text" name="name"/><br>
    <label>Phone<font color="red">*</font></label><br>
        <input id="element_4_1" name="element_4_1" class="element text" size="3" maxlength="3" value=""  type="text"> -
        <input id="element_4_2" name="element_4_2" class="element text" size="4" maxlength="4" value="" type="text"> -
        <input id="element_4_3" name="element_4_3" class="element text" size="10" maxlength="10" value=""  type="text" required >
    <label>Email<font color="red">*</font></label><br>
    <input id="email" class="form-control" style="height:35px;width:230px;border-radius:4px;" required type="email" name="text"/><br>
    <label for="input4">Message</label>
    <textarea name="contact_message" class="form-control" rows="4" id="input4"></textarea>
    <button type="submit" style="margin-left:65px;"class="btn btn-large btn-info" id="button">Submit</button>   

And the contact.php which I call is like this :

if( $_REQUEST[name] &&
    $_REQUEST[element_4_1] &&
    $_REQUEST[element_4_2] &&
    $_REQUEST[element_4_3] &&
    $_REQUEST[email] &&
   echo " Thank You ";

I get this error when I call the function : jquery:-[object Object] error. How can I call this.


Don't cast objects to strings:

console.log("Error: "+t);

Debug objects as objects:

console.log("Error: ", t);

Need Your Help

ObjectDataSource and null parameters objectdatasource coalesce vwdexpress

I'm using Visual Web Developer 2008 EE using a Dataset (.xsd) to develop an invoicing application and i'm having trouble creating a custom search query.

obfuscate password in qt

qt encryption passwords

I want to store a password (no hash) on my disk. it's nothing sensitive but i just don't want it in plaintext on my disk.