Using either .ajax or .load, I m loading content from an .html page into or replace an element. In either case, the content is called and inserted and there is a mysterious new line (not a break element , but like a or ) appended after my content from the .html file.
在chrome的元素检查器中,它看起来像:
<div class="loaded parent">
// all my loaded content
</div>
"
(ghost line)
"
代码中没有中断,所以我不知道这是从哪里来的。
.html文件:
<div id="ForgotPasswordForm" class="ajax">
<h2>Reset Your Password test</h2>
<div class="BlockContent">
<p> Enter your email below to request a password reset. An email will be send with a reset link. </p>
<p class="ErrorMessage" style="display:none"></p>
<form action="/login.php?action=send_password_email" method="post" onsubmit="return check_forgot_password_form()">
<div>
<dl style="width: 270px;margin: 0 auto;height: 30px;">
<dt style="float: left;width: 100px;text-align: right;margin:5px 5px 0 0;"> <span class="Required">*</span> Email Address: </dt>
<dd style="float:left;font-size:12px;width:150px;">
<input style="padding:4px;" type="text" class="Textbox" name="email" id="email" />
</dd>
</dl>
<p class="Submit" style="text-align:center">
<input type="submit" value="Continue" />
</p>
</div>
</form>
</div>
</div>
脚本:
$( #recover-pass ).click(
function(e){
e.preventDefault();
//$( #login-content ).load( /content/ResetPassword.html );
$.ajax({
url: /content/ResetPassword.html ,
success: function(data) {
$( #login-content ).replaceWith(data);
alert( Load was performed. );
}
});
});