I'm having a rough time trying to figure out how to make my blade sentences to be ignore as a string when I use an ajax method.
this is my code so far
Ajax method
/* SEARCH BREAKFAST AJAX */
$('#search').on('change',function(e) {
var category_id = e.target.value;
console.log("category_id : "+category_id);
$.get('dishes/ajax_breakfast?search='+category_id,function(data){
console.log(data);
$.each(data,function(index,breakFastObj){
$("#dishes").append("<li class='list-group-item'><span class='badge'>{{ link_to('dishes/' ."+ breakFastObj.id+" ,'Ver',null) }}</span>"+
"Nombre del platillo : "+breakFastObj.name+" - Categoria : {{ \\App\\Category::find(+"+breakFastObj.category_id+")->description_es+ }} </li>");
});
},'json');
});
I want to flecht data from my model Category and also want to use the link_to(), but I understand that Javascript makes those:
{{ link_to('dishes/' ."+ breakFastObj.id+" ,'Ver',null) }}
{{ \\App\\Category::find(+"+breakFastObj.category_id+")->description_es+ }}
strings and the output I get is:
Nombre del platillo : Crepa - Categoria : {{ \App\Category::find(1)->description_es }} {{ link_to('dishes/.'3,'Ver',null)}}
and What I expect to get is:
Nombre del platillo : Crepa - Categoria : Desayunos - Ver
I would appreciate some help with this one or even I know if it is possible.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire