How to submit a form in Semantic UI?

后端 未结 8 1583
南旧
南旧 2021-02-04 07:57

I know how to validate a form using Semantic UI, and can even read in console the message \"Form has no validation errors, submitting.\" However, where is this submitting to? I

8条回答
  •  萌比男神i
    2021-02-04 08:22

    If you have a form like this

    Tell Us About Yourself

    Submit

    you can use the foolowing script to send the form

    $('.ui.blue.submit.button').on('click', function() {
      submitForm();
    });
    
    function submitForm() {
      var formData = $('.ui.form.segment input').serializeArray(); //or .serialize();
      $.ajax({
        type: 'POST',
        url: '/handler',
        data: formData
      });
    }

提交回复
热议问题