当前位置: 代码迷 >> 综合 >> JQuery小技巧
  详细解决方案

JQuery小技巧

热度:41   发布时间:2024-01-25 00:37:19.0

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

 

  相关解决方案