I'm trying to change the data in an input field that I dynamically create through jquery.
I tried with:
$(document).on('keyup', '.albaran', function () {
var albaran = $(this).val();
$.ajax({
type: "POST",
url: '@Url.Action("AlbaranValidar", "Inicio")',
data: { 'Albaran': albaran },
success: function (data) {
$(this).data('error', data);
},
error: function (r) {
alert("Error del servidor");
}
});
});
I've been trying with
$(this, '.albaran').data('error', data);
But it would have to be done with an on () since it is created dynamically