从PHP函数返回的jQuery数组数组、函数、PHP、jQuery

由网友(呵呵很好你继续)分享简介:我有一个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函数,返回的数组。什么是接收这个使用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 =htt​​p://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.

阅读全文

相关推荐

最新文章