我有一小段代码,这个:
$(document).ready(function () {
$("#check").blur(function () {
var member = check.value;
$('#loading-image').show("fast");
$.getJSON('/Endpoint/MemberName/' + member, function (result) {
// var data = JSON.parse(result);
var json = result;
if (json.result.length != 0) {
$("div#preload h2").html("Nombre: " + json.result[0].fullName);
jQuery('#services').show("fast");
}
else {
$("div#preload h2").html("No encontrado!");
jQuery('#services').hide("fast");
}
$('#loading-image').fadeOut("fast");
});
});
});
在Firefox和Chrome中,代码段正在按预期工作,但在IE浏览器中,我收到以下错误:
SCRIPT5009:'check'未定义
有什么可以帮我解决这个问题的想法?
编辑:添加了检查文本框字段:
<div class="input-group col-md-12">
<input type="text" class="form-control input-lg" placeholder="Buscar numero de socio" id="check" name="check" />
<span class="input-group-btn">
<button class="btn btn-info btn-lg" type="button">
<i class="glyphicon glyphicon-search"></i>
</button>
<button class="btn btn-primary btn-lg" type="button" data-toggle="modal" data-target="#myModal">
<i class="glyphicon glyphicon-plus"></i> Añadir Cliente sin Cuenta
</button>
</span>
</div>
答案 0 :(得分:1)
var member = this.value;
var member = $(this).val();