1
$('#delete').on('click', function(e){
var id = '123';
// layer.confirm('confirm delete?', {
// btn: ['ok','cancel'] //buttons
// }, function(){
$.ajax({
type: 'post',
url: '/test', // ===== could get id =====
dataType: 'json'
})
.done(function(data){
if(data.code === 1){
debugger // ===== could't get id ? ======
layer.msg('delete success', {icon: 1});
}else{
layer.msg('success fail', {icon: 1});
}
})
.fail(function(err){
layer.msg('success fail', {icon: 1});
})
// })
})
我使用$阿賈克斯()()完成。當完成解僱,無法獲得關於「調試器」的外部變量「ID」?jQuery的阿賈克斯()便無法獲得外部變量
對於reslove「它看起來像你的文章主要是代碼;請添加一些更多的細節。」,添加一些單詞。其實我解釋這個問題很明顯。
從發佈的代碼中,'id'在該範圍內可用,並且沒有理由不這樣做。 – adeneo