I am trying to assign value I receive from the php file to the jquery variable. The php file runs a loop and echos out a value. I am trying then to store the value in the jquery variable but I am getting NaN
result back. How can I assign the value echoed from the php file into the variable in the jquery function?
var increment;
event.preventDefault();
$.ajax({
type: 'POST',
url: 'increment.php',
data: $(this).serialize(),
dataType: 'text',
success: function (data) {
//console.log(data);
data = increment;
}
});