如何将其转换为数组?

时间:2011-05-22 00:33:18

标签: javascript jquery arrays

如果我想包括steve,john,bobby和peter,我该如何将其变成数组?

getBlogs('#all-blogs', blogUrl+ '?user=steve', 5, feedUrl);

-edit-更多信息

这就是现在用javascript设置的方式。

function getBlogs(element, url, limit, feed){
        jQuery(element).load(url+ ' .blog_list:lt('+ limit+ ')', function(){

            jQuery(".postbody p:first").replaceWith(function() {
                return jQuery(this).contents();
            });
        });
    }

    var blogUrl = 'http://mysite.com/profiles/blog/list';
    var feedUrl = '/profiles/blog/feed';
    getBlogs('#all-blogs', blogUrl+ '?user=steve', 5, feedUrl);

基本上,我想在其中加入john,bobby和peter的博文。

1 个答案:

答案 0 :(得分:3)

getBlogs('#all-blogs', blogUrl+ '?user=steve,john,bobby,peter', 5, feedUrl);

然后在服务器上用逗号分隔