jQuery returns undefined variable - doesn't take html value
Posted: Sat Oct 10, 2009 11:05 am
Hi all
I have this html code (with Smarty) :
And for this I have jQuery function :
But when I am looking in firebug the mailbox variable is undefined, I was also trying with find('li').val() (commented part) but the same results....how to fix it ?
And second question, as u can see the load() function loads the content to 'html' but I don't know if it is good solution, cause it should just load the index.php instead of the file which exists before load() call. Is there a better way ?
I have this html code (with Smarty) :
Code: Select all
<div id="menu"> <ul> {section name="i" loop=$box} <li value="{$box[i]}"><a href="#" class="menu" >{$box[i]}</a></li> {/section} <li><a href="#">Recived</a></li> <li><a href="#">Filter</a></li> <li><a href="#">Spam</a></li> </ul></div> Code: Select all
$("#menu").find('li').click(function() { $('html').load("index.php", {'mailbox': $(this).find('li').attr('value'),//find('li').val(), 'controller' : 'mailbox', 'action' : 'mailbox'}); }); And second question, as u can see the load() function loads the content to 'html' but I don't know if it is good solution, cause it should just load the index.php instead of the file which exists before load() call. Is there a better way ?