oziLoadData

Version: 4.0.2Updated: 2026-05-27

Description

Transport and integration engine of the ozi-ui library. Performs data collection, submission and handling in different execution modes, with support for visual destination, API integration and behavior control.

oziLoadData was born as a plugin, but is becoming the intelligent plumbing between interface, data and backend — a true engine, bridge and transport layer of the Ozi Library.


Examples

[1] Form with validation

Automatic validation — the button stays inactive until all required fields are filled.

Valid first name is required.
Valid last name is required.
@
Your username is required.
Please enter your shipping address.
Please select a valid country.
Please provide a valid state.
Zip code required.
<button type="button"
    data-zld-url="/api/example/response"
    data-zld-destiny-id="response1"
    data-zld-catch-group-id="actionForm1"
    class="btn btn-primary">
    Submit
</button>

[2] Two simultaneous forms

Collects data from two different groups in a single submission.

Form Aid="demoFormA"

Form Bid="demoFormB"
<button type="button"
    data-zld-url="/api/example/response"
    data-zld-destiny-id="response2"
    data-zld-catch-group-id="demoFormA, demoFormB"
    class="btn btn-primary">
    Submit
</button>

[3] Collect by item name

Collects only fields with specific names — ignores the rest.

<button type="button"
    data-zld-url="/api/example/response"
    data-zld-destiny-id="response3"
    data-zld-catch-group-id="demoFormC"
    data-zld-catch-item-name="car,bike,plane:jfk airport"
    class="btn btn-primary">
    Submit
</button>

plane:jfk airport — sends the field with a fixed value defined in the attribute.


[4] Via JavaScript — current

Call via oziLoadData({...}) directly in JavaScript.

oziLoadData({
    zldUrl:           '/api/example/response',
    zldDestinyId:     'response4',
    zldCatchGroupId:  ['demoFormJS'],
    zldCatchItemName: ['car','bike']
});

[5] Via JavaScript — legacy

Compatibility with the previous version using the ld prefix instead of zld.

// ld prefix — compatibility with previous version
oziLoadData({
    ldUrl:           '/api/example/response',
    ldDestinyId:     'response5',
    ldCatchGroupId:  'demoFormLegacy',
    ldCatchItemName: 'inputLegacy:star-trek'
});

[6] Response return

Example of the PHP response the backend returns to the frontend.

Backend PHP — response example:

<?php header('Content-Type: text/html; charset=utf-8'); ?>

<h6 class="fw-bold">Received content</h6>
<div class="m-3">
    <?php
    $data = $_POST ?: $_GET;
    foreach ($data as $key => $value) {
        echo "<div>
            <span class='text-primary'>{$key}:</span>
            <span class='text-muted'>{$value}</span>
        </div>";
    }
    ?>
</div>
<hr>
<div class="text-end text-muted" style="font-size:12px">
    Date/Time: <?php echo date('Y-m-d H:i:s'); ?>
</div>

Structured JSON return:

{
    "perm":   1,
    "isJson": false,
    "ok":     true,
    "status": 200,
    "data":   null,
    "html":   "<h6>Received content</h6>...",
    "error":  null
}

Features

  • Dynamic submission — supports fetch, window and page modes
  • Flexible collection — collects data by group, individual item or JSON
  • Visual response — sends return to a specific destination in the DOM
  • Two simultaneous formscatch-group-id accepts multiple IDs
  • Collect by namecatch-item-name selects specific fields
  • Fixed valuefield:value sends value defined in the attribute
  • Legacy compatibility — accepts ld prefix from previous version
  • API integration — facilitates data-oriented calls
  • Form clearing — clears fields after submission when configured
  • Debug support — displays detailed logs via data-zld-log

HTML Attributes

[1] Submission

Attribute Description
data-zld-url Defines the submission endpoint
data-zld-mode Submission mode: fetch, window or page
data-zld-mode-method Request method: GET or POST
data-zld-mode-page-target Page target: _self, _blank, _parent, _top

[2] Data Collection

Attribute Description
data-zld-catch-group-id Collects data within the given id — accepts multiple comma-separated
data-zld-catch-item-name Collects fields by name — accepts field or field:fixed_value
data-zld-file File handling: audio-webm, image, PDF
data-zld-json Sends structured data as Array or JSON string alongside FormData
data-zld-checkbox Defines or assists checkbox value handling

[3] Response / Destination

Attribute Description
data-zld-destiny-id Defines the response destination in the DOM
data-zld-destiny-append Appends the response to the given destination
data-zld-destiny-Before Inserts the response before the given destination
data-zld-expect-json Adjusts headers for JSON and facilitates Laravel integration
data-zld-api Defines the call as API mode, focused on data response

[4] Behavior / UX

Attribute Description
data-zld-form-busy Prevents multiple clicks during the request
data-zld-form-clear Clears forms after submission, except hidden fields
data-zld-reload-script Reloads scripts of class ld-reload in legacy scenarios

[5] Debug

Attribute Description
data-zld-log Enables debug logs in the console

[6] Compatibility

Adapted for IIFE → Async/Await, avoids conflicts, immediate execution, private scope and base prepared for SPA. Accepts legacy ld prefix (e.g. ldUrl, ldDestinyId) for compatibility with previous versions.