JSFiddle - React, Tailwind, and code Playground

by Michael Russell

HTML

<div ng-app ng-controller="jsonp_example">
    <button ng-click="doRequest()">Make JSONP request</button>
</div>

JavaScript

function jsonp_example($scope, $http) {
    $scope.doRequest = function() {
        var url = "http://public-api.wordpress.com/rest/v1/sites/wtmpeachtest.wordpress.com/posts?callback=JSON_CALLBACK";

        $http.jsonp(url)
            .success(function(data){
                console.log(data.found);
            });
    };

    var url = "http://public-api.wordpress.com/rest/v1/sites/wtmpeachtest.wordpress.com/posts?callback=JSON_CALLBACK";

    $http.jsonp(url)
        .success(function(data){
            console.log(data.found);
        });
}