Wait, this is not mootools behavior, this is general json, and has nothing to do with the version of mootools. Are you sure you have your json objects right? Use firebug and log them step by step console.log(p) console.log(p[ind]) console.log(p[ind][name]) ... And see what is causing your problem.
On Jan 13, 6:43 am, wang suya <[email protected]> wrote: > Hello everyone > > I want to seperate JSON arry, the version 1.1 I can use > > p[ind][name], p[ind][kkid] > > but new version can not realize by this methods and bellow method can not > be > success. Who can tell me how can I realize it? thank in advance. > > Wang Suya > > My mootools program is bellow: > > ......... > var pnode1 = tree.insert({text:'プロジェクト文書', id:'1'}); > var snode1 = tree.insert({text:'社外文書',id:'2'}); > var index1 = []; > var b = new String; > b = ''; > b = "d0"+"="+1 > var myajax = new > Request.JSON({url:"get_kokyaku.php",method:'post',onComplete:func > tion(mystring){ > alert(mystring.p0); > var cnt = mystring.p0; > (cnt).times(function(ind){ > var st = new String; > var sid = new String; > st = mystring.p+ind+.name; > sid = mystring.p+ind+.kkid; > alert(st); > alert(sid); > index1[ind] = pnode1.insert({text:st,id:sid}); > }) > > }}); > myajax.send(b); > > my php program is bellow: > > <?php > require_once('HTML/AJAX.php'); > require_once('HTML/AJAX/JSON.php'); > > require_once('process.conf'); > require_once('sql.inc'); > require_once('tools.inc'); > > session_start(); > $k = sprintf("d%d",0); > if(isset($_POST[$k])) $i =$_POST[$k]; > > $j = 1; > $r = sql_exec("select kkid,name from kokyaku where bunnsyo_bunnrui = '$i'"); > while($ar = sql_fetch_array($r)){ > $l = sprintf("p%d",$j); > $j++; > $a[$l]['kkid'] = $ar[0]; > $a[$l]['name'] = $ar[1];} > > $a[p0] = $j; > $json = new HTML_AJAX_JSON(); > $js = $json->encode($a); > print"$js"; > > ?> > > wang suya
