1.取得BaseUrl
一般在common.js定义,其他画面引用common.js,就可以直接使用了。
$.getBaseURL = function() {
var protocol = window.location.protocol;
var hostname = window.location.hostname;
var port = window.location.port && (":" + window.location.port);
var contextPath = window.location.pathname.split('/')[1];
return protocol + "//" + hostname + port + "/" + contextPath;
}
来源:CSDN
作者:Hate_Less
链接:https://blog.csdn.net/Hate_Less/article/details/103999294