糟糕,使用jQuery AJAX [英] Oops on using jQuery AJAX

查看:51
本文介绍了糟糕,使用jQuery AJAX的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我有一个名为"product.htm"的文件.我想将其加载到div中.我使用以下命令:("div").load("product.htm");
但是当我运行页面时,它会编码我的html文件,因此将该文件作为文本加载.
就像< b>来&l.t; b&g.t;
如何停止编码以像html一样加载它?
预先感谢您的帮助.

Hi All,
I have a file with name "product.htm". I want to load it in to the div. I use the command: ("div").load("product.htm");
But when I run the page, it encode my html file so load that file as a text.
Like <b> come &l.t;b&g.t;
How can i stop encoding to load it like a html?
Thanks in advance for your help.

推荐答案

这是我刚刚尝试过的一个小示例,但找不到您遇到的错误:
文件: Test.html
This is a small example I just tried out and I can''t find the error you encountered:
File: Test.html
<html>
<head>
<script type="text/javascript" language="javascript">
</script>
</head>
<body onload="">
<h1>Hello world</h1>
</body>
</html>


这是加载前一个文件的文件:
文件: LoadDiv.thml


This is the file that loads the former file:
File: LoadDiv.thml

<!DOCTYPE html>
<html>
<head>
    <style>
    </style>
    <script src="http://code.jquery.com/jquery-1.5.js"></script>
</head>
<body>
    <div id="myTip" class=".div">This should be replaced with something from a file!</div>
    <script type="text/javascript">
        function loader()
       
            //alert("Hello!");


(#myTip").load("./Test.html"); } window.setTimeout(loader,1500); < /script > < /body > < /html >
("#myTip").load("./Test.html"); } window.setTimeout(loader, 1500); </script> </body> </html>


调用product.html的网址会得到什么?它可以正确显示吗?
干杯!
-MRB


What are you getting if you call up the URL of product.html? Does it display correctly on its own?
Cheers!
-MRB


感谢您的回答.我不会得到html标签.没有html文字.但我没有负载就解决了我的问题.谢谢
Thanks for your answer. I wont to get the html tags. No text of html. But I fix my problem without load. Thanks


这篇关于糟糕,使用jQuery AJAX的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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