Skip to content

Instantly share code, notes, and snippets.

@tripflex
Last active November 14, 2019 13:13
Show Gist options
  • Save tripflex/8203493 to your computer and use it in GitHub Desktop.
Save tripflex/8203493 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");
}
@uzbekdev1
Copy link

thx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment