mirror of
https://github.com/discourse/wp-discourse.git
synced 2025-10-03 08:59:21 +08:00
Some checks failed
WP-Discourse Formatting / Formatting on PHP 5.6 (push) Has been cancelled
WP-Discourse Formatting / Formatting on PHP 7.0 (push) Has been cancelled
WP-Discourse Formatting / Formatting on PHP 7.4 (push) Has been cancelled
WP-Discourse Formatting / Formatting on PHP 8.0 (push) Has been cancelled
WP-Discourse Tests / Tests on PHP 8.2 (push) Has been cancelled
31 lines
640 B
JavaScript
31 lines
640 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' );
|
|
|
|
if (!postId) {
|
|
return;
|
|
}
|
|
|
|
$.ajax(
|
|
{
|
|
url: commentsURL + '?post_id=' + postId,
|
|
success: function( response ) {
|
|
$commentArea.removeClass( 'wpdc-comments-loading' );
|
|
$commentArea.addClass( 'wpdc-comments-loaded' );
|
|
$commentArea.html( response );
|
|
}
|
|
}
|
|
);
|
|
}
|
|
);
|
|
})( jQuery );
|