Mautic Community Forums

Form does not return response message

I’m trying to ajax submit a form in my free Mautic.net account. The form is hosted on my website and is submited to the CMS where it goes for further processing. I wish to partially submit the form to Mautic via ajax.



Here’s my code:

Code:
$('#button').click(function() { url = 'https://my_mautic_account.mautic.net/form/submit?formId=12'; data = { 'mauticform': { 'full_name': $('#f7 [name="full_name"]').val(), 'email': $('#f7 [name="email"]').val(), 'address_full': $('#f7 [name="address"]').val(), 'formId': url.split('=')[1], 'return': 'my_return_website_url', 'formName': 'my_form_name', 'message': 1 } } $.ajax({ type: 'POST', url: url, data: data, beforeSend: function() { $('#button').attr("disabled", true); }, error: function (request, status, error) { alert(JSON.stringify(request)); }, success: function(e) { alert(e); }, complete: function (){ $('#button').attr("disabled", false); } }); });

The data is recorded by the form and stored into Contacts, but there is a CORS error that always returns the ajax.error. I added my domain name to the CORS allowed domain in the configuration.

What am I doing wrong here?

I’m trying to ajax submit a form in my free Mautic.net account. The form is hosted on my website and is submited to the CMS where it goes for further processing. I wish to partially submit the form to Mautic via ajax.

Here’s my code:

      $('#button').click(function() {
        url = 'https://my_mautic_account.mautic.net/form/submit?formId=12';
        data = {
          'mauticform': {
            'full_name': $('#f7 [name="full_name"]').val(),
            'email': $('#f7 [name="email"]').val(),
            'address_full': $('#f7 [name="address"]').val(),
            'formId': url.split('=')[1],
            'return': 'my_return_website_url',
            'formName': 'my_form_name',
            'message': 1
          }
        }
        $.ajax({
            type: 'POST',
            url: url,
            data: data,
            beforeSend: function() {
              $('#button').attr("disabled", true);
            },
            error: function (request, status, error) {
                alert(JSON.stringify(request));
            },
            success: function(e) {
              alert(e);
            },
            complete: function (){
              $('#button').attr("disabled", false);
            }
          });
      });

The data is recorded by the form and stored into Contacts, but there is a CORS error that always returns the ajax.error. I added my domain name to the CORS allowed domain in the configuration.

What am I doing wrong here?