Reputation: 4141
I tried to access variable inside blade syntax:
success: function(resp) {
console.log(resp)
var MsgClass = 'alert-danger';
$("#overlay").hide();
if(resp.success) {
MsgClass = 'alert-success';
window.location.href = "{{ asset('public/exports/'+resp.filename) }}"
}
},
But I get
Use of undefined constant resp - assumed 'resp'
How can I get this variable inside the syntax?
Upvotes: 2
Views: 45
Reputation: 5270
Just use like this
window.location.href = '"{{url('')}}/public/exports/"'+resp.filename
Upvotes: 2