我有一个PHP函数,返回的数组。什么是接收这个使用jQuery的最佳方法是什么?
I have a PHP function that returns an array. What is the best way to "receive" this using jQuery?
使用的 json_en code()把你的PHP数组到一个本地JavaScript数组,然后使用jQuery的 $。帖子, $不用彷徨或< A HREF =http://docs.jquery.com/Ajax/jQuery.ajax相对=nofollow> $。阿贾克斯的方法来从你的PHP脚本这个值。我一般使用$。员额,除非我需要的特殊功能,$就提供了。
Use json_encode() to turn your PHP array into a native JavaScript array, then use jQuery $.post, $.get, or $.ajax methods to fetch this value from your PHP script. I generally use $.post unless I need the special features that $.ajax provides.