我有3個環境 - 發展,舞臺和產品。我依靠jQuery來做一些Ajax顯示。 所以我在開發類似的東西:在不同的環境中的jQuery腳本的URL?
function needsForcedReset() {
$.get("http://dev/_layouts/Ajax/DoesUserNeedForceResetPassword.aspx", function(result) {
alert('got the data from force password ajax page: ' + result);
if (result.toString().length > 0) {
showAlert('Your have to change your domain password now', 0,
false, false, notificationClass.fail);
return true;
}
return false;
});
return false;
}
所以關注點是$不用彷徨函數中的硬編碼鏈接。我如何使用jQuery進行編碼,以使鏈接相對於_layouts/ajax或代碼的路徑,而不必爲每個不同的部署場景指定主機的url地址?