Wednesday, 18 September 2013

Uncaught reference error: xy not defined but working

Uncaught reference error: xy not defined but working

I have something like this in which the value gets updated
($('#'+name+userid).val(value);), but the userid variable cannot be found.
If I define a new userid variable as a.attr('userid'), the value does not
get updated. Why is this working then?
$.ajax({
url: '../modify_users_admin.inc.php',
type: 'POST',
data: {
value: a.attr('value'),
name: a.attr('name'),
userid: a.attr('userid')
},
success: function(data) {
$('#'+name+userid).val(value);
if (data) {
console.log('s');
alert(data);
}
else {
$('#notice').text('Updated');
$('#notice').fadeOut().fadeIn();
}
}
});

No comments:

Post a Comment