Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/85.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
Ajax JQuery影响多个元素_Ajax_Jquery - Fatal编程技术网

Ajax JQuery影响多个元素

Ajax JQuery影响多个元素,ajax,jquery,Ajax,Jquery,试图用一个load()命中两个元素,但在我尝试的过程中没有成功。这就是我现在要刷新的页面上的一个部分,它工作得很好 $('#refreshme_'+request).load("http://www.example.com/add_list/"); 我试过这个 $('#refreshme_'+request, .xPlanner).load("http://www.example.com/add_list/"); 这根本不起作用。要使我的代码高效,需要一次调用刷新2个DOM。有什么想法吗

试图用一个
load()
命中两个元素,但在我尝试的过程中没有成功。这就是我现在要刷新的页面上的一个部分,它工作得很好

$('#refreshme_'+request).load("http://www.example.com/add_list/");
我试过这个

$('#refreshme_'+request, .xPlanner).load("http://www.example.com/add_list/"); 
这根本不起作用。要使我的代码高效,需要一次调用刷新2个DOM。有什么想法吗

var request = "foo";
$("#refreshme_" + request + ", .xPlanner").load("http://www.example.com/add_list/");

Lorem
乱数假文

工作。这就是你想做的吗?

我想知道你是否不能使用类似于:

$.get("http://www.example.com/add_list/", function(data) {
    $('#refreshme_'+request).html(data);
    // same for second
});

您将要使用。请改为获取:

    $.get("http://www.example.com/add_list/", function(data) {
        $("#refreshme1").html(data);
        $("#refreshme2").html(data);
    });
这是假的,但你明白了

    $.get("http://www.example.com/add_list/", function(data) {
        $("#refreshme1").html(data);
        $("#refreshme2").html(data);
    });