recover data ajax symfony

Wednesday, November 4, 2015

I have a sql query in the symfony controller that returns me an array and I want to recover the data via ajax



  $statement = $connection->prepare("select name, first name from Contact WHERE name LIKE 'aaaa'");
//$statement->bindValue('id', 123);
$statement->execute();
$results = $statement->fetchAll();


this request gets a array (registration list)



how I can treat using ajax result this is what I do but it does not work



success: function(data) {
if (data != ''){
$ulSub = $("#res");

$.each(data, function (i,item) {
$ulSub.append( // append directly here
'<li class="ui-widget-content">' +dataa.nom, +dataa.prenom +'</li>');
});
}


I want to display the result in an html list

0 comments:

Post a Comment