I get [object of object] from my ajax response.
$.ajax({ type: "GET", data: "id_1="+id_1+"&id_2="+id_2, url:"ajax/url.php" }).done(function(data){ var left= $(data).find("#left"); $("#left").html(left); alert(left); });
In my url, I just have a simple encoding
if(isset($_GET["id_1"]) && isset($_GET['id_2'])){ $id_1 = $_GET["id_1"]; $id_2 = $_GET['id_2']; $right= $dbh->prepare("SELECT COUNT(*) FROM table WHERE id_1 = ?"); $right->execute(array($id_1)); $left= $dbh->prepare("SELECT COUNT(*) FROM table WHERE id_1 = ? "); $left->execute(array($id_2)); <div id='right'><?php echo $right->fetchColumn();?></div> <div id='left'><?php echo $left->fetchColumn();?></div> }
When I do all this, it sends back [the object of the object]
Does anyone know why he is doing this?
Thanks!
EDIT:
I added some coding to .done (function ())
source share