Commit 4ebfec1e by rajshah

feat: download count in resource detail v0.4

parent d83ea70e
...@@ -341,28 +341,3 @@ ...@@ -341,28 +341,3 @@
}) })
})(jQuery); })(jQuery);
// download count
jQuery(document).ready(function ($) {
$('#btn-resource-download').on('click', function () {
const resourceId = $(this).data('resource-id');
$.ajax({
url: frontend_ajax_object.ajax_url,
type: 'POST',
data: {
action: 'increment_download_count',
resource_id: resourceId,
},
success: function (response) {
if (response.success) {
$('#download-count').text(response.new_count);
} else {
console.log(response.message);
}
},
error: function () {
console.log('Error processing the request.');
},
});
});
});
\ No newline at end of file
...@@ -608,3 +608,28 @@ ...@@ -608,3 +608,28 @@
}); });
}); });
})(jQuery); })(jQuery);
// download count
jQuery(document).ready(function ($) {
$('#btn-resource-download').on('click', function () {
const resourceId = $(this).data('resource-id');
$.ajax({
url: frontend_ajax_object.ajax_url,
type: "POST",
data: {
action: "increment_download_count",
resource_id: resourceId,
},
success: function (response) {
if (response.success) {
$("#download-count").text(response.new_count);
} else {
console.log(response.message);
}
},
error: function () {
console.log("Error processing the request.");
},
});
});
});
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment