slightlyoff
asked on
Sending variables in Javascript
inside a function, I have code that generates html that includes a javascript function that sends a variable to another function.
It looks like this:
The issue is, the finalID variable (a string) isn't being quoted correctly, so i get an syntax error or an undefined object error.
how do I get finalID sent to sawpvids?
Thanks for your help!
It looks like this:
searchVidResult += '<div class="triovid lastvid"><a href="#" onclick="swapvids('+ finalID +');">....
The issue is, the finalID variable (a string) isn't being quoted correctly, so i get an syntax error or an undefined object error.
how do I get finalID sent to sawpvids?
Thanks for your help!
Your example is missing a final single quote. In addition, you may need quotes around '+ finalID +' but you have already used both single and double quotes. I'm not sure how to resolve that.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window
?Remove "var " and then add this to the very top above all other JavaScript code:
Open in new window