-
-
Save plaidpowered/af3e583dd168f60b10ca7ad566451076 to your computer and use it in GitHub Desktop.
Get person content - Ajax
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//team showcase | |
var $xhrObject; | |
$(document).unbind("click").on("click", ".tshowcase-box", function (event) { | |
$this = $(this); | |
$this.siblings().removeClass('active'); | |
$('.person-content-wrap').hide(); | |
$this.toggleClass('active'); | |
var url = $(this).find('a').attr('href'); //get url | |
var new_url = url.substring(0, url.indexOf(' ')); //substirng url | |
if ( undefined !== $xhrObject) { | |
$xhrObject.abort(); | |
} | |
//get person content | |
$xhrObject = $.ajax({ | |
url: new_url, //Pass URL here | |
type: "GET", //Also use GET method | |
beforeSend: function() { | |
if($this.hasClass('active')) { | |
$('.tshowcase-box.active').append('<div class="person-content-wrap"><p class="loading-team-content">Loading...</p></div>'); | |
} | |
}, | |
success: function(data) { | |
var content = $(data).find('.tscontent').html(); | |
// console.log(content); | |
$('.person-content-wrap').empty(); | |
$('.person-content-wrap').append(content); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment