Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/69.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
Javascript jQuery load()有200个响应代码,但所需内容未加载到所选元素中_Javascript_Jquery_Jquery Ui_Jquery Ui Dialog_Jquery Load - Fatal编程技术网

Javascript jQuery load()有200个响应代码,但所需内容未加载到所选元素中

Javascript jQuery load()有200个响应代码,但所需内容未加载到所选元素中,javascript,jquery,jquery-ui,jquery-ui-dialog,jquery-load,Javascript,Jquery,Jquery Ui,Jquery Ui Dialog,Jquery Load,在一个JSP文件中,我有一个元素: <div id="mydialog"></div> 我正在尝试将p标记从NewFile.jsp加载到我的对话框div中。 以下是NewFile.jsp: <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%

在一个JSP文件中,我有一个元素:

<div id="mydialog"></div>
我正在尝试将p标记从NewFile.jsp加载到我的对话框div中。 以下是NewFile.jsp:

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<p>Sample text.</p>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<p id="target">Sample text.</p>
</body>
</html>

#p
正在查找
id=“p”
元素。您只有一个
p
。您需要添加
id
,或者将选择器更改为
…NewFile.jsp
,也就是说,返回整个HTML页面似乎是浪费。如果您只是想从服务器获取一些文本,返回JSON或XML,或者在加载页面时包含服务器端的文本,并在单击
a
时切换其可见性感谢您的快速响应,我将进行必要的更改,并根据我的结果进行更新。这个任务实际上只是一个练习,目的是让我了解我的“主要”目标。我发布的最后一个问题进一步说明了这项任务,但它实际上是为了替换window.showModalDialog()。我还没有收到任何回复,我认为IE5应用程序到IE11的迁移指南并不可靠。是的,在NewFile.jsp的p标记中添加了id=“target”。示例文本现在显示出来,谢谢,Rory。
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<p id="target">Sample text.</p>
</body>
</html>
myDialog.load('/console/admin/NewFile.jsp #target').dialog("open");