var phoneBookTableValue = [];
phoneBookTableValue.push({ "key":"1", "value":["3396,Accounting ,CCH,,,,","1"]});
phoneBookTableValue.push({ "key":"2", "value":["3284,Acute Care ,CCH,,,,","2"]});
phoneBookTableValue.push({ "key":"3", "value":["326开发者_如何学编程5,Acute'Care East ,CCH,,,,","3"]});
When running the javascript file I get the error "missing ] after element list. Can U help me? PLZ!
That is not JSON, that is just literal Javascript objects. JSON is a text format based on Javascript syntax.
There is nothing wrong with the Javascript code. You could also copy the literal objects from the code and paste together into a JSON string, and it would work.
Are you converting the objects to JSON later on? In that case there is something wrong with that code.
I ran your code in Firefox, Chrome and IE8 with no trouble. What browser are you using? I would guess the real problem is in how the JSON is being eval'ed.
精彩评论