I am looking for a way to “update” or “change” a live function. For example:
$('select[name=someexample]').live('change',function(){
var url = '/'+escape(this.options[this.selectedIndex].value)+'/<?=$var?>';
pageload(url);
});
Each time “someexample” is changed, it uses ajax to call a page and return the output. The function above is in the Ajax page as that is where the new variable comes from.
I tried:
$('select[name=someexample]').die('change');
before the live function, but it doesn’t seem to remove, so that the new function overrides it. What happens is that the first live function always stays active.
EDIT
This is resolved. Instead of the variable, I just read the selected value.
The reason this wasn’t working was because .html() was stripping out the javascript. What was a better solution in this case was instead of using a PHP variable, I set it to read the current select value, which didn’t need the function updated.