woolyg Posted October 4, 2011 Share Posted October 4, 2011 Here's my javascript: for(i=0;i<=20;i++) { // msg_data_array is a string with 20 items in it, all delimited by 2 hashes - ## var msgtext = msg_data_array[i].split('##'); } The script returns msgtext just fine, but I'm getting an error in firebug: msg_data_array is undefined .. Can anybody shed any light on this? All info appreciated. Thanks WoolyG Link to comment https://forums.phpfreaks.com/topic/248382-what-am-i-doing-wrong-here/ Share on other sites More sharing options...
Adam Posted October 4, 2011 Share Posted October 4, 2011 As the error says, msg_data_array is undefined - where do you define it? Link to comment https://forums.phpfreaks.com/topic/248382-what-am-i-doing-wrong-here/#findComment-1275528 Share on other sites More sharing options...
woolyg Posted October 4, 2011 Author Share Posted October 4, 2011 Sorry, I should have specified. msg_data_array is an array built out of a long string (messages_list), split and delimited by two colons. Just above the for() loop, is this code: var msg_data_array = messages_list.split('::'); Any ideas? Link to comment https://forums.phpfreaks.com/topic/248382-what-am-i-doing-wrong-here/#findComment-1275730 Share on other sites More sharing options...
Adam Posted October 5, 2011 Share Posted October 5, 2011 Can you show the code in context? There doesn't appear to be anything wrong with the statements you've shown, so it's likely something else around them. Also you quote the error, is that the exact error? If it was "msg_data_array is undefined", then it's because that index doesn't exist. Link to comment https://forums.phpfreaks.com/topic/248382-what-am-i-doing-wrong-here/#findComment-1276014 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.