smartadmin-ajaxcall

    // LOAD AJAX PAGES
    function loadURL(url, container) {
        $.ajax({
            type: "GET",
            url: url,
            dataType: 'html',
            cache: true,
            beforeSend: function(){
              container.html('<h1><i class="fa fa-cog fa-spin"></i> Loading...</h1>').fadeIn('fast');
            },
            success: function (data) {
                container.html(data).fadeIn('slow');
                drawBreadCrumb();
                // console.log("ajax request successful")
            },
            error: function (xhr, ajaxOptions, thrownError) {
                container.html('<h4 style="margin-top:10px; display:block; text-align:left"><i class="fa fa-warning txt-color-orangeDark"></i> Error 404! Page not found.</h4>');
                //container.hide().html('<h1><i class="fa fa-cog fa-spin"></i> Loading...</h1>').load("ajax/error404.html").fadeIn('slow');

                drawBreadCrumb()
            },
            async: false
        });

        console.log("ajax request sent");
    }
No comments yet.

Leave a Reply