嗨,我是一个问题,似乎帖子没有返回对 Jquery 的任何回复,有人能指出我的错误吗?我的 HTML
<head runat="server">
<title>Untitle</title>
<script src="./script/jquery-1.8.3.min.js" type="text/javascript"></script>
<script src="./script/jquery.masonry.min.js" type="text/javascript"></script>
<script src="./script/missingkids.js" type="text/javascript"></script>
</head>
<body>
<form id="form1" runat="server" method="post">
<div>Call to JS and return <br />
<div id="retnTxt">Return Info</div>
<input type="button" id="btnCallJs" onclick="BtnCal()" value="CallJS" />
</div>
</form>
</body>
</html>
我的 JS 失踪儿童
var rtnObj = null;
var ds_handler = "ds_handle.aspx";
function BtnCal()
{
//alert("asdf");
$.post(ds_handler,
{"Action":"MainAct", "SubAction":"SubAct"},
function(response)
{
alert(response); //no alert running here??
rtnObj = response.Data
$("#retnTxt").html(rtnObj);
}, "json");
}
我的句柄 aspx.cs
public partial class MissingKids_handle : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (Request.Form["Action"] == "MainAct")
{
if (Request.Form["SubAction"] == "SubAct")
{
string ans = "Hello";
Response.Clear();
Response.Write(ans);
Response.End();
}
}
}
}
}
我只想将值返回到 Return Info,但似乎不起作用。有人可以指出我的失误吗?
谢谢