I used class as an example to show what each variable was.
Test code is like this
This function is used to process $.getJSON data
process(data) {
args = data[i].a // data is an array of commands, a = green
$('#text').addClass(args); // does not work
$('#text').addClass(args.toString()); // doe
> addClass(json.class) addClass and jquery die with no visible error in firebug
I've found proper exception handling can help track down "no visible
error" type bugs:
try {
// code here
} catch(e) {
alert("There was a problem with that code: " + e);
}
But like Karl said, using "class" is probabl
Sidenote: If you do need to use "class" as an attribute / property
name you could access it via:
json['class']
Karl Rudd
On 2/27/07, Richard Thomas <[EMAIL PROTECTED]> wrote:
> I am trying to pass a value to addClass, If I hardcode 'green' it works
> if I do var = green
> addClass(var)
>
> I
In JavaScript "class" is a reserved word. Perhaps that's the problem?
If not then it'd be best to post a URL to an example page so we can
have a look at it.
Karl Rudd
On 2/27/07, Richard Thomas <[EMAIL PROTECTED]> wrote:
> I am trying to pass a value to addClass, If I hardcode 'green' it works
>
I am trying to pass a value to addClass, If I hardcode 'green' it works
if I do var = green
addClass(var)
It works
If I try to use a value from jquery json data like
addClass(json.class) addClass and jquery die with no visible error in
firebug
If I do
json.class.toString() it works, Prior to ve