Magic Icon Predefined JSON parsing: AJAX: Magic JavaScript

Quick Jump ↵

Magic can parse a returned JSON object if you want to do more advanced things with the returned data

Usage

Add data-mjf_ajax_call_on_success="magic_json" to your tag along with the normal Magic JS AJAX attributes.

Your returned JSON object should be structured using the example below.

Definitions

Example

Get me a JSON object and then populate the three <td> tags below with the returned content.

AJAX JSON 1 Content AJAX JSON 2 Content AJAX JSON 3 Content AJAX JSON 4 Content
Red Blue Green

The last JSON item will also update this <p> tag.

The HTML

Returned JSON

Notes

The JSON object will be evaluated based on the order of the objects.

This applies to any type of Magic AJAX request. AJAX On Click was used simply as an example.

« Back to the main documentation