data-input-attr

Add static data to your ajax request parameters to avoid input hidden fields.

When you work on a table with actions (such as edit or delete), that's common to have a line number or a database id(!) or such that identifies each row.

Usage


  • data-input-attr="dataname [otherdata ...]"
  • data-dataname="something"
  • data-otherdata="otherstuff"
  • ...

Example


  • data-input-attr="id"
  • data-id="42"

Live examples

This form looks like this:


<div
        id="input"
        style="width: 100%; height: 150px; border: 1px solid black; background-color: #AAAAAA;"
        data-endpoint="input-attr-cursor-handler.php"
        data-output="#output"
        data-input-attr="left top"
        >Click somewhere inside this box
</div>

<script type="text/javascript">

    $('#input').click(function (e) {
        var offset_t = $(this).offset().top - $(window).scrollTop();
        var offset_l = $(this).offset().left - $(window).scrollLeft();
        var left = Math.round((e.clientX - offset_l));
        var top = Math.round((e.clientY - offset_t));
        $(this).data('left', left);
        $(this).data('top', top);
        $(this).domAjax();
    });

</script>

<div id="output"></div>


See also    data-input   data-raw 

Table of contents

All the documentation at a glance

Domajax options

And more with domajax