js中$ajax({})想调用php的路径问题
我现在的情况是想把原来代码用CI重构,遇到一个问题,原来的js代码里
htmlobj = $.ajax({
type : "post",
url : "../php/add_comment.php",
data : {
'article_id' : article_id,
'user_id' : user_id,
},
async : false
});
标红色地方的路径现在找不着了,但是我的目录结构里是有这个目录和文件的。
求助应该怎么改?
site_url('php/add_comme'); <base href="<?=base_url()?>"/> 傲罗 发表于 2013-1-1 21:07 static/image/common/back.gif
site_url('php/add_comme');
你写的这种好像只能在PHP里嵌入script的时候用 273579540 发表于 2013-1-2 00:19 static/image/common/back.gif
恩,用你说的方法可以 在head里面制定base标签,然后js里面写相对路径就可以了。
http://codeigniter.org.cn/forums/thread-13219-1-1.html yunnysunny 发表于 2013-1-4 12:59 static/image/common/back.gif
在head里面制定base标签,然后js里面写相对路径就可以了。
http://codeigniter.org.cn/forums/thread-13219 ...
恩,谢谢,你贡献的项目我有时间见再看看。 如果你用了url_helper
http://codeigniter.org.cn/user_guide/helpers/url_helper.html
如果没用,那么你就从了它吧 另外 3L的方法也可以
不过总觉得要用这个标签得慎重考虑{:soso_e141:} ichou 发表于 2013-1-5 00:28 static/image/common/back.gif
如果你用了url_helper
http://codeigniter.org.cn/user_guide/helpers/url_helper.html
这些函数好像只能用到Php里内嵌的js里,在单独的js文件里,我不知道怎么使用,求解
页:
[1]
2