Page is a not externally linkable
- Code, Content, and Presentation
-- JavaScript and AJAX
---- help with possible timing issue when replacing portion of dom element.


Fotiman - 5:32 am on May 20, 2012 (gmt 0)


Ok, so looking more closely, I can see why that didn't work. We still didn't end up with a closure for the callback function. Try this, keep the cell3 variable as defined above, then add another function which returns a function. We'll execute this function passing in the cell3 variable, and thereby creating the closure:

function dynamicCallback(cell3) {
return (function (data) {
$(this).html(data.replace('option value="'+cell3+'"', 'option selected="selected" value="'+cell3+'"'));
});
}
$('tr#'+id+' select[name="wi-PLID"]').load('php/wo-pricelist-se-script.php?wo.SVID='+SVID, data, dynamicCallback(cell3));


Thread source:: http://www.webmasterworld.com/javascript/4454994.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com