url跳转问题
这个问题已经发现两次了:比如我有一个text输入框,我输入东西,然后点击确认,按照我的逻辑,应该跳转到A页面。但是现在不知道为什么,每次都会跳到一个与我程序根本没有关系的其他页面去,比如:www.google.com.hk页面。。。请问这个问题各位大神是怎么解决的?
我想肯定是我哪里程序写错了。。。 不一定。 那请问是什么原因呢?能不能说的详细一点呢?
谢谢大神喽 有码有真相,无码无真相 哎,感觉论坛上面人气不旺啊。。。
不知道是不是CodeIgniter的用户不多,还是说各位大神都喜欢潜水呢?
帖子我自己来结贴吧。
问题我自己解决了。
最近我在使用CodeIgniter来做ajax,是参考Ibm developer那个专家写的做的,感觉上面的小细节很不详细啊,自己做的过程中发现了一大堆的问题。比如我在上文中提到的问题。
发现这个问题原因如下:
34 // Ajax request to CodeIgniter controller "ajax" method "autosuggest"
35
36 // post the str parameter value
37
38 $.post('index.php/ajax/autosuggest',{ 'str':str },
39 function(result) {
40
41 // if there is a result, fill the list div, fade it in
42
43 // then remove the loading animation
44
45 if(result) {
46
47 $('#autosuggest_list').html(result);
48
49 $('#autosuggest_list').fadeIn(500);
注意38行。貌似我这么写的话,会跳转到:
www.yourexample.com/index.php/ajax/index.php/ajax/autosuggest
而其实这个页面是不存在的,因为存在的页面是:
www.yourexample.com/index.php/ajax/autosuggest
同时由于我的firefox浏览器默认主页是www.google.com.hk,所以当www.yourexample.com/index.php/ajax/index.php/ajax/autosuggest页面无法访问的时候,浏览器自动重定向到了我的默认主页,所以才出现这个问题。。。
囧啊
我邮箱 zhulicong89@gmail.com有问题希望大家一起讨论
希望论坛人气越来越旺 结果应该是38行改成如下:
38 $.post('autosuggest',{ 'str':str },
页:
[1]