Skip to content

Instantly share code, notes, and snippets.

@uzbekdev1
Forked from tripflex/smartadmin-ajaxcall
Created May 16, 2017 13:38
Show Gist options
  • Save uzbekdev1/ecdd181703edba1a5c65c2ceb0799d80 to your computer and use it in GitHub Desktop.
Save uzbekdev1/ecdd181703edba1a5c65c2ceb0799d80 to your computer and use it in GitHub Desktop.
// 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");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment