php - Object has no method sort -


i having issue php javascript , sorting. have following js script

function sortby(param, data) {     switch (param) {     case "aplha":         console.log(data);         data.sort();         break;     } } 

the array passing through json_encode , array looks

array ( [0] => array ( [name] => 123456 [clean_name] => 123456 [createdate] => 1372479841 ) [1] => array ( [name] => 123456 [clean_name] => 123456 [createdate] => 1372479841 ) ) 

however above error when try pass data.sort(). ideas?

php arrays aren't js arrays, json objects, can't have , array on js code. however, there's workaround, refer this answer more info.

cheers


Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -