87,907
社区成员
发帖
与我相关
我的任务
分享
$(function(){
alert("aa\nbb"); //这里能正常换行
$.post(
"Default.aspx",
function(response){
alert(response); //这里输出的就是"aa\nbb"
}
)
})
response.write("aa\nbb"); //这里测试的时候,还用\\n测试,\r,<br />都没有换行效果。
response.end();
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript" src="Scripts/jquery-1.4.1.js"></script>
<script type="text/javascript">
$.post(
"other.aspx",
function (response) {
alert(response);
}
)
</script>
</head>
<body>
</body>
</html>
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Response.ClearContent()
Response.Write("aa\r\nbb")
Response.End()
End Sub
End Class
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script>
$(function () {
$.post(
"Default.aspx",
function (response) {
alert(response); //这里输出的就是"aa\nbb"
}
)
})
</script>
</head>
<body>
</body>
</html>
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Response.ClearContent();
Response.Write("aaa\r\nbbb");
Response.End();
}
}
Response.ClearContent();
Response.Write("aaa\r\nbbb");
Response.End();