SoundCloud working on WordPress JSON API

SoundCloud working on WordPress JSON API
ESPN
// Example JSONP request with jQuery
$.ajax({
url: “http://api.espn.com/v1/sports/news/headlines”,
data: {
// enter your developer api key here
apikey: “{7jwgjwpupg3nmbzan5k4umwq}”,
// the type of data you’re expecting back from the api
_accept: “application/json”
},
dataType: “jsonp”,
success: function(data) {
// create an unordered list of headlines
var ul = $(‘

    ‘);
    $.each(data.headlines, function() {
    var li = $(‘
  • ‘).text(this.headline);
    ul.append(li)
    });
    // append this list to the document body
    $(‘body’).append(ul);
    },
    error: function() {
    // handle the error
    }
    });
    ESPN Code End

    $(‘#’ + id + ‘ .content1’).bind(‘click’, function (e) {
    e.preventDefault();
    getContent(‘/function-demos/functions/ajax/data/content1.html’);
    });

    $(‘#’ + id + ‘ .content2’).bind(‘click’, function (e) {
    e.preventDefault();
    getContent(‘/function-demos/functions/ajax/data/content2.html’);
    });

    $(‘#’ + id + ‘ .content3’).bind(‘click’, function (e) {
    e.preventDefault();
    getContent(‘/function-demos/functions/ajax/data/content3.html’);
    });

    function getContent(filename) {
    $.ajax({
    url: filename,
    type: ‘GET’,
    dataType: ‘html’,
    beforeSend: function () {
    $(‘#’ + id + ‘ .contentarea’).html(‘‘);
    },
    success: function (data, textStatus, xhr) {

    if (filename == ‘/function-demos/functions/ajax/data/content3.html’) {
    setTimeout(function () {
    $(‘#’ + id + ‘ .contentarea’).html(data);
    }, 2000);
    } else {
    $(‘#’ + id + ‘ .contentarea’).html(data);
    }
    },
    error: function (xhr, textStatus, errorThrown) {
    $(‘#’ + id + ‘ .contentarea’).html(textStatus);
    }
    });
    }




    jQuery Function Demo – jQuery4u.com



    getContent('/function-demos/functions/ajax/data/content2.html');
    });

    $('#'+id+' .content3').bind('click', function(e)
    {
    e.preventDefault();
    getContent('/function-demos/functions/ajax/data/content3.html');
    });

    function getContent(filename)
    {
    $.ajax({
    url: filename,
    type: 'GET',
    dataType: 'html',
    beforeSend: function() {
    $('#'+id+' .contentarea').html('');
    },
    success: function(data, textStatus, xhr) {

    if (filename == '/function-demos/functions/ajax/data/content3.html')
    {
    setTimeout( function() {
    $('#'+id+' .contentarea').html(data);
    }, 2000);
    }
    else
    {
    $('#'+id+' .contentarea').html(data);
    }
    },
    error: function(xhr, textStatus, errorThrown) {
    $('#'+id+' .contentarea').html(textStatus);
    }
    });
    }

    },

    reset: function(id)
    {
    $('#'+id+' .contentarea').html('Content will appear here.');
    $('#'+id).hide();
    }
    }
    }
    }


    Demo: Using $.ajax() to load content without reloading the entire page.

    HTML content is held in separate files which are inserted below using AJAX. Note that it is also courtesy to show a loading image while the AJAX request is processing. Content 3 has a 2 second delay to simulate the loading image.

    Run Demo View Code

    Content will appear here.




    Microsoft Office 2010

    Polycom Cx5000 Unified Conference Station For Microsoft Lync (Amazon) Amazon Logo

    $4300.00



    Buy Now

    Microsoft Surface (32gb) (Amazon) Amazon Logo

    $539.95



    Buy Now

    + 11 others available from Amazon
    Microsoft Office Home & Business 2010 - 2pc/1user (one Desktop And One Portable) (disc Version) (Amazon) Amazon Logo

    $278.00

    Buy Now
    Microsoft Software Office Home And Business 2010 English Pc Attach Key Product Key Card For 1pc (Amazon) Amazon Logo

    $219.69

    Buy Now
    Microsoft Office Home & Student 2010 - 3pc/1user (disc Version) (Amazon) Amazon Logo

    $179.99

    Buy Now
    Microsoft Office Home & Business 2010 Product Key Card- 1pc/1user [download] (Amazon) Amazon Logo

    $150.09

    Buy Now
    Go! With Microsoft Office 2010, Vol. 1, And Student Videos (Amazon) Amazon Logo

    $128.49



    Buy Now

    Microsoft Office Home & Student 2010 - 3pc/1user [download] (Amazon) Amazon Logo

    $124.99

    Buy Now
    Microsoft Office Home & Student 2010 Product Key Card- 1pc/1user [download] (Amazon) Amazon Logo

    $99.99

    Buy Now
    New Perspectives On Microsoft Office 2010, First Course (Amazon) Amazon Logo

    $87.20



    Buy Now

    Microsoft Natural Ergonomic Desktop 7000 (Amazon) Amazon Logo

    $81.78



    Buy Now

    Microsoft Office 2010: Introductory (shelly Cashman Series(r) Office 2010) (Amazon) Amazon Logo

    $69.49



    Buy Now

Leave a Reply

Your email address will not be published. Required fields are marked *