I'm doing a script that send data to a particular PHP
page and getting the result, after that the jQuery
will check the result and distribute it.
The data is sent without any problem, and it is distributed fine. However whenever i want to print the distributed data in their rows I'm getting all the values as Undefined, and this is the code that i tried:
$(document).ready(function () {
$('textarea').css("resize", "none");
var recource = $('#recource').val().split("\n");
var socks = $('#socks').val().split("\n");
$("button").click(function () {
for (i = 0; i < recource.length; i++) {
$.ajax({
type: 'POST',
url: 'ajax.php',
data: 'email=' + recource[i],
success: function (data) {
if (data == "Hey, OK") {
$('#live').append('<br />' + recource[i]);
} else {
$('#die').append('<br />' + recource[i]);
}
}
});
}
});
});