Created
December 18, 2019 21:31
-
-
Save nikolab/08b57404ef2510943626dce610e53268 to your computer and use it in GitHub Desktop.
Get person content - Ajax
This file contains 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 | |
$(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 | |
//get person content | |
$.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