0
応答が空のときに「結果が見つかりません」というメッセージを表示したい場合があります。その時にバックエンドセッションが期限切れになると、 jsonデータが必要なので、どのようにこのhtmlデータを処理できます。
$("#customers_name")
.bind("keydown", function(event) {
if (event.keyCode === $.ui.keyCode.TAB &&
$(this).autocomplete("instance").menu.active) {
event.preventDefault();
}
})
.autocomplete({
source: function(request, response) {
$.getJSON("ajax_functions.php", {
term: extractLast(request.term),
console: $('select[name="console"] option:selected').val(),
call: 'getCustomersEmailList',
nmsAdmin: '<?php echo tep_session_id();?>'
}, response);
},
change: function (event, ui) {
if(!ui.item){
$("#customers_name").val("");
}
},
focus: function() {
return false;
},
select: function(event, ui) {
var customer_id = ui.item.customer_id;
var customer_email = ui.item.customerEmail;
console.log(ui);
$('#customer_id').val(customer_id);
$('#customer_email').val(customer_email);
var terms = split(this.value);
terms.pop();
terms.push(ui.item.value);
terms.push("");
this.value = terms.join("");
return false;
}
});
これはどういう意味ですか? http://stackoverflow.com/a/4719848/961526 –
@RaphaëlAlthaus:ええ、これは1つの質問でしたが、そのときに応答がHTMLデータを返すときはどうすればいいですか... – codever
これをもっとグローバルに管理することができます:http ://stackoverflow.com/questions/12703942/handling-session-time-out-when-ajax-call-to-c-sharp-mvc-controller-not-workingまたはhttp://stackoverflow.com/questions/5238854/handling-session-time-in-ajax-calls –