当我删除更新面板和脚本管理器时,javascript不起作用..目标是将所选日历日期发送到将在web方法中完成的数据库,如果我删除更新面板n scrpt manager js有效,但回帖后,我想让javascript与scriptmanger n updte面板一起工作吗?
<script type="text/javascript">
$(function () {
$("[id*=btnApplyLeave]").bind("click", function () {
if (divCalendar.style.display == "none")
divCalendar.style.display = "";
else
divCalendar.style.display = "none";
var user = {};
user.uname = $("[id*=txtUserName]").val();
user.from = $("[id*=TextBox1]").val();
user.to = $("[id*=TextBox2]").val();
user.days = $("[id*=Label1]").val();
user.purps = $("[id*=txtPurpose]").val();
// user.propic = $("[id*=propicupload]").val();
if (user.uname == '') {
alert("Enter the Username!");
return;
}
if (user.from == '') {
alert("Select a Leave Start Date from the Calendar!");
return;
}
if (user.to == '') {
alert("Select a Leave End Date from the Calendar!");
return;
}
if (user.purps == '') {
alert("Enter the reason for requesting a leave!");
return;
}
$.ajax({
type: "POST",
url: "RequestLeave.aspx/SaveUser",
data: '{user: ' + JSON.stringify(user) + '}',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (response) {
alert("Leave Request Sent!");
window.location.reload();
}
});
return false;
});
});
</script>
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate>
从这里直到scrpt manger n更新面板的结束标签之间我只有asp日历和文本框以及提交按钮(&#39; btnApplyLeave)