我在搜索字段中遇到了这个问题。当我点击输入按钮时,搜索会被触发,但只能在 Chrome 中成功运行。如果我在 IE 中点击 enter 按钮,页面中唯一的变化,如果我点击按钮,第二次进行搜索......工作。
$( document ).ready(function(event) {
$("#searchField").keypress(function(event) {
if (event.which == 13) {
search_value = $('#searchField').val();
proj_id = $('#projectId').val();
//alert (search_value + '-' + proj_id);
searchMeeting(search_value, proj_id);
}
});
});
function searchMeeting(search_value, proj_id) {
var lastSearchValue = $('#searchField').val();
if (proj_id != "") {
$.ajaxSettings.traditional = true;
$.ajax({
url : '../meeting/searchMeeting.action',
type : 'post', // method
dataType : 'html',
data : { // data to send
"searchValue" : search_value,
"projectId" : proj_id
},
error : function() { // fail
alert('Failed to search!');
},
success : function(html) {// success
$('#backToList').attr("style","display: none;");
$("#meeting_content").html(html);
$("#searchField").val(lastSearchValue);
bindTableEvents();
}
});
}
}