I need to pass data from controller to view this is my code :
Controller :
function requete()
{
$id = Str::random();
echo json_encode($id);
return view('Demo.requete');
}
View :
$(document).ready(function() {
$.ajax({
url: "",
method: "get",
data: data
dataType: "json",
success: function(data)
{
$('#code').html(data); //nothing happens here
}
});
});
The data is displaying on top of the page not in the '#code' section and i get this error :
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire