为什么我的ajax找不到action

    <script type="text/javascript">
/**
 * 检查用户名是否存在
 */
function checkName(){

var xmlhttp;
    var name = document.getElementById("user.username");
    var values = name.value;
    var username = document.getElementsByName("userName");

    [color=red]var url = "isexist";//我的url[/color]
    if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
        xmlhttp = new XMLHttpRequest();
    } else {// code for IE6, IE5
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    }

    [color=red]xmlhttp.open('GET', url, true);//运行到这里就报错了(firebug报错)[/color]

    xmlhttp.send("userName="+values);

    xmlhttp.onreadystatechange = function() {

        if (xmlhttp.readState == 4 && xmlhttp.status == 200) {

            if ("yes" == xmlhttp.responseText) {
                document.getElementById("user.userName").value = "";

                alert("用户名已存在");
                return;

            }

        }
    };
}</script>
这是我的js,我的struts在下面:



/register.jsp

别的action都可以找到,因为本页面我定义了个form,提交的action直接写action名就可以了,但是我的ajax说什么页找不到action,包括加上绝对路径也不行

这样,你先弄个from提交。能提交到后台,然后在做个ajax,如果from能提交,那么就是ajax提交代码有问题,还有哥们用原生态ajax..都用jquery了。原生态的ajax有很多问题

路径,加全路径:
例如:http://localhost:8080/项目名/****/isexist