Can someone assist me in identifying the issue? I keep receiving an Unexpected identifier error when attempting to use ajax for sending comments. Code:
function funcSuccess(data) {
$("#comment_ajax").text(data);
}
function funcBefore() {
$("#comment_ajax").text("Loading comment...");
}
$(document).ready(function() {
$("#make_comment").bind("click", function() {
event.preventDefault();
$.ajax({
let post = $("#c_post_id").val();
let user = $("#c_user_id").val();
let text = $("#c_text").val();
url: "write_comment.php",
type: "POST",
data: { c_post_id: post, c_user_id: user, c_text: text },
dataType: "html",
beforeSend: funcBefore,
success: funcSuccess
});
});
});
The error is occurring on the line "let post = $("#c_post_id").val();". What mistake have I made?