この関数が壊れる理由がわかりましたか?
window を使用してグローバル配列の値を取得します。console.log で arr オブジェクトの値を取得しますが、foreach で arr オブジェクトを使用しようとすると、コードが壊れます。理由はありますか?
function setDropDownList(raw_id, val){
// Get the ID
var the_id = '#'+raw_id;
// Get the array name as a string
var arrname = val+"Array";
// get the arr object using the arrname string
var arr = window[arrname];
// if I place a console.log here, i get the values for the arr object, but it brakes the .each below:
// do a simple foreach
// using arr breaks the foreach loop
// if I use the actual array declared globally in he header it works.
jQuery.each(arr, function(key, value) {
var test = value.split('|');
});
}