如何显示使用jQuery load()来阿贾克斯多个项目分为多个元素呢? [英] How to show use jQuery load() to ajax multiple items into multiple elements?

查看:71
本文介绍了如何显示使用jQuery load()来阿贾克斯多个项目分为多个元素呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要加载从一个大页面的某些项目到页面中的不同元素。在code我写的是工作,但项目由一个和大量的停顿之后,装载之一。我想我可能会做错误的方式,因为我不是一个完整的开发者,但只是一个设计师。

I need to load certain items from a big page into a page's different elements. The code I wrote is working but items load one by one and after a lot of pause. I am thinking I might doing it wrong way as I am not a complete developer but just a designer.

我的code看喜欢:

$("#lot-rental").load("/est.html #est-rental");
$("#lot-deposit").load("/est.html #est-deposit");
$("#lot-date").load("/est.html #est-date");
$("#lot-build").load("/est.html #est-build");

请帮我它有点急了我。您的帮助将是AP preciated。谢谢

Please help me its kinda urgent for me. Your help will be appreciated. Thanks

推荐答案

使用 $。获得()加载数据,然后手动设置各种元素的含量

Use $.get() to load the data and then set the content of the various elements manually.

$.get('/est.html', function(data) {
    $.each(['rental', 'deposit', 'data', 'build'], function(i, key) {
        $('#lot-' + key).html($(data).find('#est-' + key));
    });
}, 'html');

这篇关于如何显示使用jQuery load()来阿贾克斯多个项目分为多个元素呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆