+ -
当前位置:首页 → 问答吧 → 急求,ajax 错误500 。在线等,马上给分~~

急求,ajax 错误500 。在线等,马上给分~~

时间:2011-08-23

来源:互联网

JS代码;
JScript code

function test1()
    {

            var uname;
            var upwd;
            uname = document.frames("iframe2").document.getElementById("email").value;
            upwd = document.frames("iframe2").document.getElementById("password").value;
            try 
            { 
                xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); 
            } 
            catch (e) 
            { 
                try 
                { 
                    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); 
                } 
                catch (e) 
                {  
                    try 
                    { 
                        xmlHttp=new XMLHttpRequest(); 
                    } 
                    catch (e) 
                    { 
                    } 
                } 
             }  
            var url =  "http://localhost/login_ajax.aspx?name="+uname;
            alert(url);
            xmlHttp.open("GET",url, true);              
            xmlHttp.onreadystatechange=updatePage;
            xmlHttp.send(null)
            function updatePage()
              { 
                if(4==xmlHttp.readyState) 
                { 
                    alert(xmlHttp.status);
                    if(200=xmlHttp.status) 
                    { 
                        alert(xmlHttp.responseText);
                        if (xmlHttp.responseText=="yes") 
                        {  
                           alert("1"); 
                        } 
                        else 
                        { 
                            alert("2");                           
                        }  
                    } 
                    else 
                    { 
                      alert("3");
                    }
                } 
              } 
           
        }




login_ajax.aspx的JS 代码:
JScript code

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="login_ajax.aspx.cs" Inherits="login_ajax" %>
<%Response.Write(returnvalue);%>

login_ajax.aspx.cs
C# code


public partial class login_ajax : System.Web.UI.Page
{
    public string returnvalue = "";
    protected void Page_Load(object sender, EventArgs e)
    {
        returnvalue = "yes";
               
    }
}



报500的错。请教是怎么回事呀。代码有什么问题吧?急,马上给分~~~

作者: Tracy_fu   发布时间: 2011-08-23

public partial class login_ajax : System.Web.UI.Page
{
  protected void Page_Load(object sender, EventArgs e)
  {
  Response.Write("yes");
  }
}

作者: wangyu19820830   发布时间: 2011-08-23