2
0
Fork 0
mirror of https://github.com/discourse/wp-discourse.git synced 2025-10-03 08:59:21 +08:00
wp-discourse/js/load-comments.js
2019-08-26 14:13:18 -07:00

27 lines
592 B
JavaScript

/* globals wpdc */
/**
* Loads Discourse comments into the .wpdc-comments div.
*
* @package WPDiscourse
*/
(function( $ ) {
$( document ).ready(
function() {
var commentsURL = wpdc.commentsURL,
$commentArea = $( '#wpdc-comments' ),
postId = $commentArea.data( 'post-id' );
$.ajax(
{
url: commentsURL + '?post_id=' + postId,
success: function( response ) {
$commentArea.removeClass( 'wpdc-comments-loading' );
$commentArea.addClass( 'wpdc-comments-loaded' );
$commentArea.html( response );
}
}
);
}
);
})( jQuery );