2014-05-23 44 views
1

我有一個腳本,檢查兩個或多個選項是否相同。如果他們是相似的,我會阻止提交頁面。它的工作原理,但只有當我顯示警告消息後刷新頁面。如果我選擇一個優惠選項,那麼錯誤警報仍在內存中,除了我刷新頁面。有沒有辦法使用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(); 
    } 
}); 
+0

@RohitBatham重新加載頁面的535點的方式,讀取標籤問題...... –

回答

1
history.go(0); 

使用歷史方法

相關問題