-
-
Save pcfreak30/8ab5b4ed6cf7ea3c2c63f1a85b8eccd8 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 | |
var request = $.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); | |
} | |
}); | |
$object.click(function(){ | |
request.abort(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment