Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/75.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
jqueryajax斗争_Jquery_Html - Fatal编程技术网

jqueryajax斗争

jqueryajax斗争,jquery,html,Jquery,Html,我一直在网上搜索,直到我情绪低落,但我无法弄清楚这一点以及为什么它不起作用 我有javascript,但这只适用于firefox。没有其他浏览器 所以,我决定去jQuery 我想做的是: -我有一个文件夹。 -在这个文件夹中,我有一个html.html文件。这是我的主要网站。 -然后我有一个home.html文件 html.html如下所示: <html> <head> <title> Struggeling w

我一直在网上搜索,直到我情绪低落,但我无法弄清楚这一点以及为什么它不起作用

我有javascript,但这只适用于firefox。没有其他浏览器

所以,我决定去jQuery

我想做的是: -我有一个文件夹。 -在这个文件夹中,我有一个html.html文件。这是我的主要网站。 -然后我有一个home.html文件

html.html如下所示:

<html>
    <head>
        <title>
            Struggeling with jQuery ajax! *******
        </title>
    </head>
    <body>
        <div="one">
            Load the page here
        </div>
    </body>
</html>
    <html>
        <head>

        </head>
        <body>
            Please load this into the div! (this text will be displayed in other words)
        </body>
    </html>

使用jQueryAjax进行测试*******
在这里加载页面
home.html如下所示:

<html>
    <head>
        <title>
            Struggeling with jQuery ajax! *******
        </title>
    </head>
    <body>
        <div="one">
            Load the page here
        </div>
    </body>
</html>
    <html>
        <head>

        </head>
        <body>
            Please load this into the div! (this text will be displayed in other words)
        </body>
    </html>

请把这个装进div!(此文本将以其他文字显示)
我到底怎样才能使用jQuery得到这个呢?请帮帮我。我做不好

=====================================================================================

好的,这就是它现在的样子。在我的文件中,我有home.html:

<html>
    <head>
        <title>
            Struggeling with jQuery ajax! *******
        </title>
        <script language="javascript" src="jQuery.js"></script>
        <script>
            $(document).ready(function() {
                $("#one").load("html.html body");
            });
        </script>
    </head>
    <body>
        <div id="one">
            Load the page here
        </div>
    </body>
</html>

使用jQueryAjax进行测试*******
$(文档).ready(函数(){
$(“#一”).load(“html.html正文”);
});
在这里加载页面
我下载了jQuery的开发版本,这是home.html所在的文件(jQuery.js)

然后在另一个html.html中,如下所示:

<html>
    <head>

    </head>
    <body>
        Please load this into the div! (this text will be displayed in other words)
    </body>
</html>

请把这个装进div!(此文本将以其他文字显示)
但这是行不通的。我没有收到“请将此加载到div!(此文本将以其他文字显示)”的提示。

尝试此jquery

<script>
$(document).ready(function() {
    $("#one").load("home.html body");
});
</script>

$(文档).ready(函数(){
$(“#一”).load(“home.html正文”);
});
另外,更新你的html.html(我不喜欢这个名字,顺便说一句,使用index.html作为主页)目标div ID

<div id="one"></div>


编辑:我也看不到引用jQuery库的地方,一定要这样做

首先给你的div一个正确的ID

<div id="one">
    Load the page here
</div>
同时移除任何“双重”标签。换句话说,当您插入
html.html
时,您不希望:

<div id="one">
     <html>
          <body>
               Stuff
          </body>
     </html>
</div>

东西

它看起来很难看,可能会引起问题。因此,删除那些额外的
标记。

我相信你可以在jQuery中使用
.load()
函数。所以你有javascript,你已经搜索过,决定使用jQuery,但仍然没有代码发布?还需要更新html.html以获得div id=“one”而不是div=“one”。哈哈,我刚刚看到了,接得好。我对我的帖子进行了编辑。请看。我不明白。它不起作用。