我哪裏出錯了?無法獲得簡單的jquery ajaxoncomplete工作?
jQuery(document).ready(function($){
//always focus on input field
//$('#documentID').focus();
$("#btnSubmit").on("click", function(){
var docID = $('#documentID').val();
alert("test "+docID);
var lookupData = new Array();
$.ajax({
type:"POST",
url: "lookup.php",
data: {documentID: docID},
dataType: 'text',
success: function(msg){
alert(msg);//shows Wrong as expected
//do stuff after the AJAX calls successfully completes
$("#note").ajaxComplete(function(){
if(msg == "Wrong")
{
result = 'Not so OK';
$('#logo_header').hide();//just to test things
}
else
{
result = 'OK lookup';
lookuData = msg;//populate all data
}
$(this).html(result);
});//#end ajaxComplete and populate note
}//#end success
});//#end AJAX
})//#end function
});
而且lookup.php返回錯誤或OK(用於測試目的),但我不能得到DIV #note以顯示消息和DIV logo_header不隱藏。
任何信息?