heres my code so you see what i'm trying to do, which obviously isn't working:
$('#selector').change(function() {
if ($(this).val().length > 0)
{
$.ajax({
type: "POST",
url: "ajax.php",
data: "id="+$(this).val(),
success: function(data){
if (data != 'error')
{
$('#main_url').val(data[2]);
$('#main_url_title').val(data[3]);
}
}
});
}
});
i set up an alert(data); and all it pops up with is "Array". so now my 2 fields are being populated with "r" and "a"...what is the correct way of doing this?
tablewhereid='".mysql_real_escape_string($_POST['id'])."'"); if (mysql_num_rows($sql) == 0) { echo 'error'; } else { while ($row = mysql_fetch_assoc($sql)) { foreach ($row as $k => $v) $data[] = $v; } echo $data; }