data-confirm

Display a confirmation dialog before starting the ajax call

This is very easy to click on ajaxed buttons / links, even if the targetted action is important (such as entries deletions, important updates etc). This option let you display a confirmation dialog with a customised message, and the ajax call is proceeded only if users click OK button.

Usage


  • data-confirm="confirmation message"

Example


  • data-confirm="Are you sure you want to proceed ?"

Live examples

This form looks like this:


<input
        type="button"
        value="Get the current hour in France"
        class="btn domajax click"
        data-endpoint="confirm-button-handler.php"
        data-confirm="Are you really sure you want to get the current hour in France ?"
        data-output="#clock"
        />

<div style="height:10px;"></div>

<div id="clock"></div>

This form looks like this:


<label for="insert">Enter an element</label>
<input type="text" id="insert" name="insert" value="Some stuff"/>
<br/>
<input
    type="button"
    value="Send"
    class="btn domajax click"
    data-endpoint="confirm-table-handler.php"
    data-input="#insert"
    data-output="#output"
    data-confirm="Insert a new entry in the table ?"
    />

<p>&nbsp;</p>

<?php

// getting table contents
ob_start();
include "confirm-table-handler.php";
$table = ob_get_clean();

?>

<br/>

<div id="output"><?php echo $table; ?></div>


See also    data-callback   data-script 

Table of contents

All the documentation at a glance

Domajax options

And more with domajax