本文介绍了链接javascript BASEDIR的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
继续这样:
请检查我接受的答案,并使用zneak附带的BASEDIR解决方案。
Please check the answer i accepted, and i used the "BASEDIR" solution zneak came with.
现在我跑到了另一个问题..在我的ajax_framework.js中我有:
Now i ran onto another problem.. in my ajax_framework.js i have:
$.ajax({url: "session.php", success: function(data){
我应该如何将BASEDIR包括在内?我正在思考:
how should i include BASEDIR onto this? i was thinking something about:
$.ajax({url: "'.BASEDIR.'session.php", success: function(data){
但这不是PHP,所以我认为你不能?没有?任何帮助或者可能是另一种方法来解决这个问题?
but this isnt PHP, so i think you cant? no? any help or maybe another method to come around this?
推荐答案
Javascript还支持字符串连接:
Javascript also supports string concatenation:
$.ajax({url: baseDir + "/session.php", success: function(data) {
您需要设置 baseDir
Javascript 变量 Top.php
:
<script language="text/javascript">
var baseDir = "<?php echo BASEDIR; ?>";
</script>
这篇关于链接javascript BASEDIR的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!