none
Jquery Call asp.net page method. RRS feed

  • 问题

  • How can I use a jquery ajax script call my asp.net page method?

    ajax script

    $.ajax({
                    type: "POST",
                    url: "./register.aspx/registAccount",
                    data: "{loginname:'" + tbUserName + "',realname:'" + RealName + ",password:'" + tbPassword + "'}",
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    success: function (msg) {
                        // Do something interesting here.
                        alert(msg);
                    },
                    error: function (result) {
                        alert(result.status + " " + result.statusText);  
                    }
                });

    and I added the http model as

    "<httpModules>    

    <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

        </httpModules>"

    But I the script still return a error "500 error"

    Your reply is highly appreciated!

    • 已移动 Raymond TangModerator 2012年2月8日 11:53 (发件人:.NET Framework 一般性问题讨论区)
    2012年2月8日 8:21

答案