【发布时间】:2014-05-23 05:51:17
【问题描述】:
我有一个脚本可以检查两个或多个选项是否相同。如果它们相似,我会阻止该页面被提交。它有效,但前提是我在显示警报消息后刷新页面。如果我选择了一个有利的选项,错误警报仍在内存中,除非我刷新页面。
我想我可以执行“location.reload()”,但用户等待页面重新加载。有什么我可以在不执行 location.reload() 的情况下刷新页面的吗?这是我的脚本:
$("#saveBtn").click(function () {
for (var x = 0; x < checkedindex.length; x++) {
var ind = checkedindex[x];
var dateofclass = $(".TextBoxDate:eq(" + ind + ")");
var timeofclass = $(".TextBoxTime:eq(" + ind + ")");
var classday = $("select[name='searchString']:eq(" + ind + ")");
classdate.push(dateofclass);
classtime.push(timeofclass);
dayofclass.push(classday);
var testString = (dayofclass[x].val() + classtime[x].val()).toString();
if (testString.indexOf(oldDateAndTime) == 0)//returns -1 if no match is found 0 means a match was found…. there are two or more of the same string
{
alert("Please make the correct selection");
return false;
}
oldDateAndTime = (dayofclass[x].val() + classtime[x].val()).toString();
}
});
【问题讨论】:
-
@RohitBatham,阅读问题标签...
标签: jquery asp.net-mvc