Lord Relix Lord Relix - 2 months ago 8
Javascript Question

jQuery code working in FF, Chrome, not in IE

I have a small snippet of code, this:

$(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");

});
});
});


In Firefox and Chrome the snippet is working as intended, yet in IE browsers I get the following error:

SCRIPT5009: 'check' is undefined

Any idea on what could help me solve this issue?

EDIT: Added check textbox field:

<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>

Ro. Ro.
Answer
var member = this.value;
var member = $(this).val();