Reputation: 5166
This may be a small issue but I am not getting rid of this . I want to concatenate the argument in a javascript function . This is my string
html+='<a href="javascript:showchart('+data.code+');">';
data.code
value is md5 string . But if i do like this it throws the error that fe741b62ff720a180a5960c4a2c50b27
is not defined .
I know it is taking this as constant, but how can I pass this as string within this html .
Upvotes: 0
Views: 67
Reputation: 74420
You want to pass a string, then you need to wrap variable in quotes, e.g:
html+='<a href="javascript:showchart(\''+data.code+'\');">';
//<a href="javascript:showchart('fe741b62ff720a180a5960c4a2c50b27');">
Upvotes: 5