using jquery $.post() for returning multiple values
- by Aninemity
Hi all
I am trying to use a $.post() in the following way:
$.post("file.php", { file_id: $(this).val()}, function(data){...}
The file.php then does a database query and returns an array with a title, description and image reference.
What I want to do then is be able to update the .val() for form fields for each. I understand how to do this on a single variable, it would just be the following:
$.post("file.php", { file_id: $(this).val()}, function(data){
$('#title').val(data);
}
But, how do I get the data returned to be recognizable in jquery as either separate variables or as an array?
Thanks in advance