javascript - LogIn Page Using JQuery -



javascript - LogIn Page Using JQuery -

before 3 days code working fine. not. please point out error new jquery.

i debugged it, , found out debugger not entering within success method of ajax. , not going cs file.

code of jquery-

<script type="text/javascript"> $(document).ready(function () { $('#btnsubmit').click(function () { alert('b'); $.ajax({ type: "post", contenttype: "application/json; charset=utf-8", url: "admin.aspx/login", datatype: "json", data: "{'name':'" + $('#txtfn').val() + "','password':'" +$('#txtln').val() + "'}", success: function (data) { alert(data); var obj = data.d; alert(obj); alert(data.d); if (obj == 'true') { $('#txtfn').val(''); $('#txtln').val(''); alert("dasdsad"); window.location = "home.aspx"; alert("success"); } else if (obj == 'false') { alert("errorrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr"); } }, error: function (result) { alert(data); alert("aaaaaaafgdgfdfgsfgfhffghgfhgfhfghfghfhfghfhfghgfhgfhgfhgfhfghfghgfhgfhgf"); alert(result); } }); }); }); </script> </head> <body> &nbsp;<div id="login"> <div id="triangle"></div> <h1>log in</h1> <form id="f1" runat="server"> <input type="text" id="txtfn" placeholder="name" /> <input type="text" id="txtln" placeholder="password" /> <input type="submit" id="btnsubmit" value="log in" /> </form> </div> </body>

code-

[webmethod] public static string login(string name, string password) { string retmessage = string.empty; string constr = configurationmanager.connectionstrings["oltest_constring"].connectionstring; using (sqlconnection con = new sqlconnection(constr)) { string query = "select * profile name=@pname , password=@pwd"; using (sqlcommand cmd = new sqlcommand(query, con)) { cmd.parameters.addwithvalue("@pname", name); cmd.parameters.addwithvalue("@pwd", password); con.open(); sqldatareader dr = cmd.executereader(); if (dr.read()) { //retmessage = "home.aspx"; retmessage = "true"; } else { retmessage = "false"; } } homecoming retmessage; } }

you need remove

alert('b');``

on jquery code

javascript c# jquery asp.net ajax

Comments

Popular posts from this blog

c - Compilation of a code: unkown type name string -

ubuntu - Bash Script to Check That Files Are Being Created -

Php operator `break` doesn't stop while -