网页和div的动态加载(ID)

时间:2022-03-27 20:08:49

Greetings once again...

再次问候……

I am trying to populate the different main templates for a webpage as well as dynamically call two separate divs ( I have the two divs loading, at least I thought I did... It works great in FireFox 5.0 but when I try the page in IE, Chrome, Safari or Opera the content disappears when clicked.)

我正在尝试为一个网页填充不同的主模板,同时动态地调用两个独立的div(我已经加载了两个div,至少我认为我已经加载了……)它在FireFox 5.0中运行得很好,但当我在IE、Chrome、Safari或Opera中尝试时,点击时内容就消失了。

Here is the jQ:

这是金桥:

 $(document).ready(function(){

    $(".swapJustInTimeLink").click(function(){

        document.getElementById("contentAll").innerHTML = "";

        $.ajax({
          url: "dynamicPages/progSpec_justInTime.html",
          cache: false,
          success: function(html){
            $("#contentAll").append(html);
          }
       });    
    });

    $(".swapJustInTimeLink").click(function(){

        document.getElementById("textWelcome").innerHTML = "";

        $.ajax({
          url: "dynamicPages/progSpec_links.html",
          cache: false,
          success: function(html){
            $("#textWelcome").append(html);
          }
       });    
    });
 });

Can someone explain when is going on here ?

有人能解释一下这里是什么时候吗?

My jQuery as well as AJAX skills are not refined enough at the current moment, thanks for any help.

我的jQuery和AJAX技能目前还不够完善,谢谢您的帮助。

1 个解决方案

#1


4  

Any reason you're not using $.load()?

不使用$.load()的原因是什么?

$(function ()
{
    $('.swapJustInTimeLink').click(function()
    {
        $('#contentAll').load('dynamicPages/progSpec_justInTime.html');
        $('#textWelcome').load('dynamicPages/progSpec_links.html');
    });
});

#1


4  

Any reason you're not using $.load()?

不使用$.load()的原因是什么?

$(function ()
{
    $('.swapJustInTimeLink').click(function()
    {
        $('#contentAll').load('dynamicPages/progSpec_justInTime.html');
        $('#textWelcome').load('dynamicPages/progSpec_links.html');
    });
});