【发布时间】:2018-05-03 09:28:38
【问题描述】:
我无法将.env 变量加载到我的视图中我尝试了不同的方法,但我无法解决我的问题。
我的文件名是
自定义脚本.js
我的代码:
function sendBusinessDetails(saveform) {
$.ajax({//Process the form using $.ajax()
type: 'post', //Method type
url: window.APP_URL+'/Process', // here is the problem
data: saveform, //Forms name
dataType: 'json',
success: function (data) {
if (data && data.status === 1) {
alert("success");
window.location.href = "Page-list";
} else {
$("#unsuccesserror").html(data.message).show(500);
}
// window.location.href = "New-Sale-Page";
}
});
}
我的APP_URL = http://localhost:8000
我将替换为
url: window.APP_URL+'/Process', // here is the problem
我也试过另一种方法:
<?php echo env('APP_URL');?>
但我无法解决这个问题: 非常感谢您的帮助!
【问题讨论】:
标签: laravel environment-variables