Can’t get WordPress’ JSON REST API working with JQuery

I’m working my way through freeCodeCamp’s front-end projects, but I’m not having any luck with obtaining quotations using the following code; could anyone point me in the right direction?

<!DOCTYPE html>
<html lang="en">

    <meta charset="utf-8">

    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>Random Quotation Generator</title>

    <!-- Latest compiled and minified CSS -->
    <link rel="stylesheet" href="">

    <!-- jQuery library -->
    <script src=""></script>

    <!-- Latest compiled JavaScript -->
    <script src=""></script>

        $("#getQuotation").on('click', function () {
            $.getJSON("[orderby]=rand&callback=", function (data) {
                $(".message").html(data[0].content + " — " + data[0].title)

    <div class="container">
        <div class="row text-center">
            <h1 class="text-primary">Random Quotation Generator</h1>
            <div class="well col-xs-12 message">
                <h4>Click the button below to get a nice fresh quotation!</h4>
        <div class="col-xs-12 row text-center ">
            <button id="getQuotation" class="btn btn-primary">Gimme a quotation!</button>


Read more here: Can’t get WordPress’ JSON REST API working with JQuery

Leave a Reply

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