将div从弹出窗口追加到特定div

时间:2019-04-05 10:16:28

标签: jquery ajax save

我试图弄清楚如何将用户选择的div从弹出窗口追加到由ajax加载的另一页上的div。

$(".map_content_list_one ul li").on("click", function (event) {
    event.stopPropagation();
    var neighbourhood_load = $('#neighbourhood_load').val();
    if(neighbourhood_load == 0){
          neighbourhood_load = $(this).attr('data_id');
    }else{
          neighbourhood_load = neighbourhood_load+'~~'+$(this).attr('data_id');
    }
    $('#neighbourhood_load').val(neighbourhood_load);
    load_neighbourhood_product();

    $(".choosenHoods ul").append('<li><a href="#">' + $(this).text() + '</a> <i class="fas fa-times deleteHood"></i></li>');
    let el = parseInt($('.selectedHoods').text());
    $('.selectedHoods').text(el+1);

    let el1 = parseInt($('.filterCounter').text());
    $('.filterCounter').text(el+1);
    return false;
});

function load_neighbourhood_product(){
    var neighbourhood_load = $('#neighbourhood_load').val();
    $('#more_row').val(4);
    var selected_type  = $('#selected_type').val();
    $('#product_body').load("product-filter.php",{'neighbourhood_load':neighbourhood_load,'type':selected_type});
}

如您所见,当用户单击map_content_list_one ul li脚本的每个元素时,将加载product-filter.php。效果很好。

但是请检查让el1。 filterCounter类是product-filter.php上的div。加载product-filter.php时如何设置要显示的div值?

0 个答案:

没有答案