I have a function that return a proper image of a device
I declare that on top of my blade file
At the end of my blade file I have a some minor javascript
function init(){
var ajax2 = $.ajax({url: '/'+s1+'/device/'+s3+'/get'});
ajax2.done(function (devices) {
// console.log(device[0].name);
$("#deviceNameForm").addClass('hidden');
$('#deviceNameSaveBtn').hide();
$('#deviceNameCancelBtn').hide();
$('#deviceName').show();
$('#deviceNameEditBtn').show();
console.log(devices);
var name = 'Not Set';
for (i = 0; i < devices.length; i++) {
if(devices[i].mac == s3 ){
var name = devices[i].name;
}
}
//console.log(name) == Chromebook
// Now I want to use my img() here - how do I properly do that ?
$('#deviceName').text(name);
});
}
init();
I've tried
console.log({{img(name)}});
I got
Use of undefined constant name - assumed 'name'
I'm a little stuck now. Any hints on this will be much appreciated !
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire