Magic Icon AJAX Form Submission (via keyup/change): Magic JavaScript

Quick Jump ↵

Usage

Add data-mjf="ajax_submit|return_false" data-mjf_ajax_update_id="ELEMENT_ID" id="FORM_ID" to your <form> tag.

Add data-mjf="ajax_submit_kc" data-mjf_askc_form_id="FORM_ID" id="ELEMENT_ID" to your form field.

Below are the acceptable ones…

Add <script type="text/javascript">$m.wand.ajax_submit_kc = true;</script> inside your <body> tag.

Example


submits to ajax.php, the default form action

Radio Buttons


Checkboxes



submits to ajax2.php


submits to ajax3.php


Notes

The action and method attributes for your form are still required and will be used when making the AJAX call.

Add data-mjf_askc_action="/PATH/TO/NEW_ACTION" to your form field if you want your <form> to use a different action.

You may want to use Form Validation as well — data-mjf="form_required|ajax_submit|return_false" for your <form>.

« Back to the main documentation