I have one string in my JSON. the value is To be Reviewed
.
I am retrieving this string in my client side using data[i].status
syntax. It fetches the correct value but when I send this syntax as paramter it gives unterminated string literal
error on client side.
My code is:
onClick=test('"+data[i].product+"','"+data[i].status+"').
How can I send the string value in another function?
thanks in advance.
As you are appending variables you do not need the quotes around them, only the value you are assigning to the onClick
parameter. Assuming your test
function accepts two parameters, this should work:
onClick="test(data[i].product, data[i].status)"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.