I'm trying to pass variables to another function via HTML generation using Javascript but it doesn't get through. Here's my code:
var wer_people_btn1 = document.createElement("span");
wer_people_btn1.setAttribute('onclick', 'SendData(' + user.ID + " ANDINFO " + susData + ')');
function SendData(reply) {
}
user.ID contains "3323"
susData contains "< DATA > (info_user)"
The error I get:
Uncaught SyntaxError: missing ) after argument list
I think the <> brackets are causing trouble here. How do I pass these as a string to my function?