undefined variable, that shouldn
Hi all,
I've made a piece of code:
Code:
$('#reactions' + i).attr('href', 'javascript :comments('+entry.url+','+i+');');
(this is in a for statement). Than I'm trying to assign the, e.g. reactions1 variable, I just made, to a jquery mobile page like this:
Code:
document.write(
'<a href="#" id="reactions' + i + '" data-role="button" class="ui-btn-right">Reactions</a>'
);
Strange thing is, when I load this in my browser, the JS console gives me an error: "ReferenceError: Undefined variable: i_heart_chaos_ihc_after_dark_independence_day_through_a_bullhornthis_is_what" (the last thing is the value of entry.url)
I don't get why this is giving me an error in stead of just calling the comments function.
I hope someone here can help me.
Thanks in advance,
Jan Thiemen
You really miss jQuery abilities and that should be done different way
this is your mistake:
Code:
javascript :comments('+entry.url+','+i+')
when you replace entry.url with String and i with Integer you will get something like:
Code:
javascript :comments(That_is_some_freaking_string,1)
and problem with that is that this string is treated as variable now, and it's undefined so it should look like that:
Code:
javascript :comments("'+entry.url+'",'+i+')
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Bookmarks