Passing long string in javascript argument
I have a php page which i have array of values with long values.
I gave to pass this array in a javascript function like this
$canswer is an array I am imploding that and passing as arguments as follows,
$cans=implode(',',$canswer);
echo "<input type='checkbox' name='q1' id='1'
onclick=\"save_answer('1','$cans')\">";
This code is working for short values in array.When I have long values in
array,onclick is not working.When I tried to see view source,I saw the
array values cut off in the page.
I have tried the following code to give quotes for each values.But this
also not works.
$correctanswer1="'" . implode("','", $correctanswer) . "'";echo
$correctanswer1;
Regards, Rekha
No comments:
Post a Comment