List and post tasks with jQuery
Here are some improvements that can be done


Move the &lt;script&gt;s to the end of &lt;body&gt;. This way, the UI is show quickly to the end user and does not have to wait to load the scripts. Also, as the code is moved to the end of the &lt;body&gt;, all the elements are already loaded and there is no need to use ready().
Create a string of HTML and append it to the element. By this, the DOM is accessed only once for any number of items in the tasks array.
There is no need to convert the Object to String using JSON.stringify(). jQuery does this for you.
Use val() to get the value of an element. It is considered to trim the string which are entered by user.
Use unique ID on the &lt;div&gt; element and use it to select it using jQuery. $('div') will select all the &lt;div&gt; elements on the page and the results will be unexpected when there are more than one elements on page.





$.getJSON("/api/v1/tasks", function (result) {
    var html = '';
    result.tasks.forEach(function (item) {
        // Append to the string
        html += '&lt;li&gt;Task:' + item.title + ' Description:' + item.description + ' Status:' + item.done + '&lt;/li&gt;';
    });

    // Update the DOM
    $('div').append(html);
});

$("#task-form").submit(function (e) {
    e.preventDefault();

    $.ajax({
        type: 'POST',
        url: '/api/v1/tasks',
        data: {
            title: $('#title').val(),
            description: $('#description').val()
        },
        contentType: 'application/json;charset=UTF-8',
        success: function () {
            $('div').append('&lt;li&gt;Task:' + data.title + ' Description:' + data.description + 'Status: false&lt;/li&gt;');
        }
    });
});




Here's same code written using Revealing module pattern.

var taskModule = (function ($) {
    'use strict';

    // Private variables and functions
    var _apiURL = 'api/v1/tasks',
        _readTasks = function () {
            $.getJSON(_apiURL, _showTasks);
        },
        /**
         * To add new task in Database
         * @param  {Object} task Object containing task title and description
         */
        _addTask = function (task) {
            var self = this;
            $.ajax({
                url: _apiURL,
                data: task,
                success: function () {
                    _showTasks([task]);
                }
            });
        },
        _showTasks = function (tasks) {
            var taskHTML = '';

            tasks.forEach(function (task) {
                taskHTML += '&lt;li&gt;Task:' + item.title + ' Description:' + item.description + ' Status:' + (item.done || 'false') + '&lt;/li&gt;';
            });

            $('#tasksContainer').append(taskHTML);
        },
        _bindEvent = function () {
            $('#task-form').on('submit', function (e) {
                e.preventDefault();

                _addTask({
                    title: $('#title').val(),
                    description: $('#description').val()
                });
            });
        };

    // Load tasks from server
    _readTasks();

    // Bind form submit event
    _bindEvent();

    // For public Interface
    // return {
    //     publicAlias: method/Variable name
    // };
}(jQuery));