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;
}