Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xslt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用JQuery$.proxy()处理具有此上下文的$.post()回调_Jquery - Fatal编程技术网

使用JQuery$.proxy()处理具有此上下文的$.post()回调

使用JQuery$.proxy()处理具有此上下文的$.post()回调,jquery,Jquery,我试图将$.post()封装到一个对象中,并使用该对象的方法/函数处理回调。网络建议我应该使用JQuery$.proxy()来实现它。然而,jquery(或me)似乎无法获得正确的上下文 这是一个现场演示你做得对。上下文将保留在此.display中。尝试记录“this” 可能PHP文件有问题…这是我的错误。您完全正确,是php返回的json值格式不正确。感谢您的快速回答,并为我指明了正确的方向。:)对于那些对工作感兴趣的人。这里有一个。使用geonames.org json web服务。

我试图将
$.post()
封装到一个对象中,并使用该对象的方法/函数处理回调。网络建议我应该使用JQuery
$.proxy()
来实现它。然而,jquery(或me)似乎无法获得正确的上下文


这是一个现场演示

你做得对。上下文将保留在此.display中。尝试记录“this”


可能PHP文件有问题…

这是我的错误。您完全正确,是php返回的json值格式不正确。感谢您的快速回答,并为我指明了正确的方向。:)对于那些对工作感兴趣的人。这里有一个。使用geonames.org json web服务。