i have created script explode numbers 1 data-get via php:
var n_polls=<?php echo $t_random_number;?>; var myarray=n_polls.split(','); //explode (i=0;i<4;i++) { $("#t_sl_poll_"+myarray[i).hide(); }
the idea give numbers php random poll system, , want explode close in bucle id. problem is, see fail explode function javascript, time giving me nothing. how can fix this?
thank you.
take @ source. error console tell same thing. you're not putting array (not number) in quotes, fails compile during runtime:
var n_polls="<?php echo $t_random_number;?>"; //quotes! ^ ^ var myarray=n_polls.split(','); //explode (i=0;i<4;i++) { $("#t_sl_poll_"+myarray[i]).hide(); //missing bracket // ^ }
now it'd compile to
var n_polls="1, 2, 3, 4";
instead of
var n_polls=1, 2, 3, 4; //useless non-working code - not enclosed in
Comments
Post a Comment