Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/379.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
javascript中的laravel刀片变量_Javascript_Ajax_Laravel - Fatal编程技术网

javascript中的laravel刀片变量

javascript中的laravel刀片变量,javascript,ajax,laravel,Javascript,Ajax,Laravel,我尝试访问刀片语法中的变量: success: function(resp) { console.log(resp) var MsgClass = 'alert-danger'; $("#overlay").hide(); if(resp.success) { MsgClass = 'alert-succe

我尝试访问刀片语法中的变量:

            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) }}"
                }                    
            },
但我明白了

Use of undefined constant resp - assumed 'resp'
如何在语法中获取此变量?

就像这样使用

window.location.href = '"{{url('')}}/public/exports/"'+resp.filename
{{asset('public/exports/')}+resp.filename
结尾处的
+'}'
不应是必需的。