I have the follwing JS function:
function setOptions(fullName, userID, qObjID) {
document.getElementById("reportUserButt").innerHTML = "<a id='reportUserButt' href='javascript:reportUser(" + userID + ");'> <h5>Report @" + fullName + "<span style='opacity: 0.5'> -- " + userID + "</h5></a>";
}
which calls this func:
// REPORT A USER ---------------------------------------
function reportUser(userID) {
$('#optionsModal').modal('hide');
console.log("userID: " + userID);
// Show loading modal
document.getElementById("loadingText").innerHTML = "Reporting User, please wait...";
$('#loadingModal').modal('show');
$.ajax({
url:"report-user.php?userID=" + userID,
type: "GET",
success:function(data) {
var results = data.replace(/\s+/, ""); //remove any trailing white spaces from returned string
console.debug(results);
$('#loadingModal').modal('hide');
alert("Thanks for reporting this user! We will check it out within 24h.");
// Reload page
setTimeout(function(){
location.reload();
}, 100);
// error
}, error: function (e) { alert(e);}
});
}
So I'm sure that my reportUserButt is correct because it shows me the "userID" variable in my php page, but the error I get when i click that href is:
Uncaught ReferenceError: azZkVUpgbG is not defined
azZkVUpgbG is the userID I need, so what am I doing wrong?