[英]laravel blade variable inside javascript
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?如何在语法中获取此变量?
Just use like this像这样使用
window.location.href = '"{{url('')}}/public/exports/"'+resp.filename
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.