I have created a basic submission form using expression engine's plugin free form. From the CMS side of things my data is being submitted into the EE CMS. However after i have submitted my details, rather than receiving a success message i receive the following message on my form object object. <div id="form-messages" class="success">[object Object]</div>

I am assuming this has something to do with my jquery As the function was working when i was validating the submission through php.

Below is a snippet of my code.

var form = $('#ajax-contact');
var formMessages = $('#form-messages');

$(form).submit(function(e) {

var formData = $(form).serialize();

// Submit the form using AJAX.
    type: 'POST',
    url: $(form).attr('action'),
    data: formData
.done(function(response) {
    //  formMessages div has the 'success' class.

    // Set the message text.

    // Clear the form.
.fail(function(data) {
    // Make sure that the formMessages div has the 'error' class.

    // Set the message text.
    if (data.responseText !== '') {
    } else {
        $(formMessages).text('Oops! An error occured and your message could not be sent.');



            admin_notify="[email protected]"
            form:class="main-contact submit-fade ajax-form"


            <ul class="small-block-grid-2 medium-block-grid-2 hide-form">
                  <label for="name">Name</label>
                      attr:placeholder="First Name" 


                  <label for="email">Email</label>
              <input type="submit" class="btn btn-success">


1 Answer 1


By default, Freeform auto-detects if you are using AJAX for the form submission. AJAX requests will return errors and success mesages in JSON. If you wish to disable this, specify a value of no.

That's a JSON object you're getting back, buddy. Can't just dump it, you have to parse it somehow. Start by replacing this line


with this line:


and open your developer console after a test submission. Then investigate the JSON object and figure out what you're looking to dump. It's probably something like this:

// or
//// or 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.