Monday, 5 January 2015

jQuery Ajax JSON Load

Sample data.JSON:
{
            "CourseTitle": "Ordinary Annuities: Future Value and Present Value",       
            "Learn":[{"Type":"MCSS"}]  
}


Ajax JSON Load:

var jsonLoad1 = "js/data.json";
        $.ajax({
            url: jsonLoad1,
            type: "post",
            async: true,
            dataType: "json",
            data: {},
            success: function(data) {
                        alert(data.CourseTitle);
            },
            error: function() {
                alert(" Please refresh: Problem in loading MasterLoader json.");
            }

        });

No comments:

Post a Comment