嗨,我在 jquery 对话框中登录了部分视图,当我第一次单击按钮时,它确实有效。这意味着,如果文本框是空的,那么它会显示客户端错误来填充它们。但是当我第二次单击时,如果文本框是否填充,则会显示此错误:
Microsoft JScript 运行时错误:语法错误,无法识别的表达式:#
我能怎么做?
编辑:
通过单击此按钮,将显示 jquery 对话框:
<div class="buttons"> @{
if (Session["member"] != null)
{
<input type="button" value="خريد" class="btn" id="btnn" onclick="addToOrders(@item.themesModel.ThemeID, true)" />
}
else
{
<input type="button" value="خريد" class="btn" id="btnn" onclick="addToOrders(@item.themesModel.ThemeID,false)" />
}
这是显示 jq 对话框的 js 代码:
function addToOrders(themeId, user) {
var inputParams = "{themeId : '" + themeId + "'}";
if (user==true) {
$.ajax({
url: '/Members/buy/Index',
type: 'POST',
dataType: 'json',
data: inputParams,
contentType: 'application/json; charset=utf-8',
success: function (mm) {
$("#resultMessage").dialog({
show: "puff",
hide: "puff",
resizable: false,
modal: true,
position: "center",
width: 280,
height: 250,
});
$("#resultMessage").dialog().addClass(".ui-dialog");
$("#resultMessage").html(mm);
}
});
}
else {
$("#resultMessage")
.dialog({
show: "puff",
hide: "puff",
resizable: false,
modal: true,
position: "center",
title:"Login"
})
.load('/Members/MemberLoginPartial/LoginUser');
}
}
这是我在登录部分视图中的按钮代码,在对话框中呈现:
<input type="submit" value="login" />
这些是我在主布局中使用的脚本:
<script src="../../Scripts/jquery-1.5.1.js" type="text/javascript"></script>
<script src="@Url.Content("/Scripts/SlideMain/jquery.easyAccordion.js")" type="text/javascript"></script>
<script src="@Url.Content("/Scripts/SlideMain/utility.js")" type="text/javascript"></script>
<script src="@Url.Content("/Scripts/jquery-ui.js")" type="text/javascript"></script>
<script src="@Url.Content("/Scripts/MicrosoftAjax.js")" type="text/javascript"></script>
<script src="@Url.Content("/Scripts/MicrosoftMvcAjax.js")" type="text/javascript"></script>
<script src="../../Scripts/jquery.validate.min.js" type="text/javascript"></script>
<script src="../../Scripts/jquery.validate.unobtrusive.min.js" type="text/javascript"></script>
<script src="../../Scripts/jquery.unobtrusive-ajax.min.js" type="text/javascript"></script>
<script src="@Url.Content("/Scripts/Members/Members.js")" type="text/javascript"></script>