我有一个脚本,检查两个或多个选项是否相同。如果他们是相似的,我会阻止提交页面。它的工作原理,但只有当我显示警告消息后刷新页面。如果我选择一个优惠选项,那么错误警报仍在内存中,除了我刷新页面。有没有办法使用jquery刷新页面而不执行location.reload()?
我提到我可以做'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重新加载页面的535点的方式,读取标签问题...... –