We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 38878
    • 255 Posts
    I am receiving a blank response and no errors anywhere with the following setup.
    Revo 2.5.1,
    Formit 2.2.10-pl
    FormIt2DB 1.1.4-pl

    I have a form loading in a modal with the action posting to a blank resource with the following code. You'll notice I have the config from Sepia River's blog which according to the blog should return JSON back to to my ajax function:

    [[FormIt?
        &hooks=`FormIt2db`
        &successMessage=`Successfully added OrgUnit.`
        &prefix=`ws20_`
        &packagename=`ws20`
        &classname=`OrganizationUnits`
        &tablename=`organization_units`
        &submitVar=`orguniteditsubmit`
        &validate=`org_id:required,name:required,handle:required,epaid:required,admin_id:required`
        &validationErrorBulkFormatJson=`1`
        &validationErrorMessage=`{"success":false,"errors":[[+errors]]}`
        &hookErrorJsonOutputPlaceholder=`hook_error_json_response`
        &errTpl=`[[+error]]`
    ]]
    [[!+fi.validation_error_message]][[!+hook_error_json_response]]
    [[!+fi.successMessage:is=``:then=``:else=`{"success":true,"message":"[[!+fi.successMessage]]"}`]]


    Nothing is returned and the new record is not created in the db. I confirm that the ajax is submitting the data correctly. I know the class and tables are correct as I tested this without ajax submission and it works just fine. One thing that confuses me is that the placeholders are on the remote ajax processor resource according to the blog article. How do these values get passed back as a response to the ajax processor?

    For completeness, my Ajax processor is:
    $(document).on("submit", ".ajax-form", function (event) {
            console.log("Form Ajax firing");
            event.preventDefault();
            var formData = $(this).serialize();
            $.ajax({
                type: 'POST',
                url: $(this).attr('action'),
                dataType: 'json', 
                data: formData,
                success: function(data) {
                    console.log(data.responseText);
                },
                error: function(data) {
                    console.log(data.responseText);
                }
            });
        });


    Any ideas would be awesome. Thx.
      • 38878
      • 255 Posts
      *bump*