Skip to content Skip to sidebar Skip to footer

How To Pass A Variable Into Jquery's $.post Success Callback Function

I want jquery to keep track of multiple $.posts and know which one it's referring to on success. I'm running this app on a really slow internet connection, so if there's a pile of

Solution 1:

I would suggest reading up on scope in javascript. By simply making your $el = $("[data-id...") variable local to the function (var $el = ...), it should remain unique to the scope that each $.post() call is made in, ensuring that the correct element is updated in the callback.


Post a Comment for "How To Pass A Variable Into Jquery's $.post Success Callback Function"