CI框架实现ajax的路径问题
<script type="text/javascript">var xmlHttp;
function GetXmlHttpObject()
{
var xmlHttp=null;
try
{
// Firefox,chrome,Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
//Internet Explorer
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}
function go(names){
var xmlHttp=GetXmlHttpObject(); //创建浏览器对象
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request");
return;
}
var url="<?=site_url()?>/login/ajax";//主要是这个路径问题
//var url="http:localhost/CodeIgniter/index.php/login/ajax绝对路径也不行
url=url+"?user="+names;
xmlHttp.open("Get",url,true);
xmlHttp.onreadystatechange = function () {
if (xmlHttp.readyState == 4 ) {
document.getElementById("result").innerHTML = xmlHttp.responseText;
}
}
xmlHttp.send(null);
}
</script>
</head>
<body>
<h2><?php echo $frist ?></h2>
<div style="color: red;"><?php if(isset($error)) echo $error;?></div>
<form action="zhi" method="post" enctype="multipart/form-data" >
<table>
<tr>
<td>用户名:</td>
<td><input type="text" name="user" value="<?php echo set_value('user')?>" size="20" onblur="go(this.value)" /><?php echo form_error('user')?></td>
<td><div style="color: red;" id="result">11</div> </td>
</tr>
<tr>
<td>密 码:</td><td><input type="password" name="password"size="20" /><?php echo form_error('password')?></td>
</tr>
<tr>
<td>确认密 码:</td><td><input type="password" name="password2"size="20" /><?php echo form_error('password2')?></td>
</tr>
<tr>
<td><input type=submit value="注册"/></td>
</tr>
</table>
</form>
</body>
</html>
总是报那个路径找不到,不知道什么原因写绝对路径也不行,也是一样的报警?404 Page Not Found
The page you requested was not found. 建议你使用CI的第三方类库cjax 多谢了! JQ的吗? //var url="http:localhost/CodeIgniter/index.php/login/ajax绝对路径也不行
//var url="http//:localhost/CodeIgniter/index.php/login/ajax绝对路径也不行
xmlHttp.open("Get",url,true);
ci的get方式开启了吗? var url="<?=site_url()?>/login/ajax";//主要是这个路径问题
//var url="http:localhost/CodeIgniter/index.php/login/ajax绝对路径也不行
--------------------------------------------------
var url="<?=site_url('login/ajax')?>/";
//var url="http://localhost/CodeIgniter/index.php/login/ajax/
这样子试试 yunnysunny 发表于 2012-6-17 12:57 static/image/common/back.gif
//var url="http:localhost/CodeIgniter/index.php/login/ajax绝对路径也不行
//var url="http//:localho ...
GET方式开启了 kjzwj 发表于 2012-6-17 22:19 static/image/common/back.gif
var url="/login/ajax";//主要是这个路径问题
//var url="http:localhost/CodeIgniter/index.php/login/aja ...
var url="<?=sit_url('login/ajax')?>/";
这样也不行 把地址拷贝到地址栏能打开吗? yunnysunny 发表于 2012-6-19 14:23 static/image/common/back.gif
把地址拷贝到地址栏能打开吗?
不行
页:
[1]
2