开发者

Using JQuery $.proxy() to handle $.post() callback with this context

开发者 https://www.devze.com 2023-03-16 01:21 出处:网络
开发者_StackOverflow中文版I tried to encapsulate $.post() to an object and handle the callback using the object\'s method/function. The net suggest that I should use JQuery $.proxy() to achieve it lik
开发者_StackOverflow中文版

I tried to encapsulate $.post() to an object and handle the callback using the object's method/function. The net suggest that I should use JQuery $.proxy() to achieve it like question. However it seems that jquery (or me) is failing to get the right context.

Here is a live demo http://jsfiddle.net/komaruloh/WSBBC/


You're doing it right. The context is preserved inside this.display. Try to log "this".

http://jsfiddle.net/WSBBC/1/

Maybe something is wrong with the PHP file...

0

精彩评论

暂无评论...
验证码 换一张
取 消