I am trying to add the values from an input field with the values of a variable inside a jquery. When doing so I get [object Object] displaying as the result. My goal is to get the value from the input field so I can then added to a variable and ultimately display on result on another textbox with id called person. The texbox I am trying to get the value from is count. How can I achieve this?
$.ajax({
type: 'POST',
url: 'person.php',
data: $(this).serialize(),
dataType: 'json',
success: function (data) {
var num = $('#count').val(data);
$('#person').val(num+ newUniqueAI);
}
});
data? Why are you passing it to.valif you want to retrieve the value? Please read the jQuery documentation: api.jquery.com/val. It contains information about how.valshould be called.#countand also use the new value for#person? What is the value ofdata? What isnewUniqueAIand its value?