jQuery getJSON Demo

Use the three buttons to load three JSON structures: a single object, an array of records, and records plus metadata.

Modern jQuery Top ↑

function addLines( target, lines ) {
    const $target = $( target ).empty();

    $.each(
        lines,
        function ( index, text ) {
            $( "<div>" )
                .text( text )
                .appendTo( $target );
        }
    );
}

$( "#b1" ).on( "click", function () {
    $.getJSON( "json1.php" )
        .done(function ( data ) {
            addLines(
                "#d1",
                $.map(
                    data,
                    function ( value, key ) {
                        return key + " => " + value;
                    }
                )
            );
        });
});

← Return to the getJSON tutorial






plus2net.com






✖
We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles Contact us
© 2000-2026 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer