Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Unhandled exception at line 133, column 5 in http://localhost:49647/Account/Login
- 0x800a1391 - JavaScript runtime error: '$' is undefined
- using System;
- using System.Data.SqlClient;
- using System.Data;
- using System.Configuration;
- namespace Login.BL
- {
- public class User
- {
- public int UserID { get; set; }
- //[Required]
- public int Username { get; set; }
- //[Required]
- public int UserPassword { get; set; }
- }
- public class UserBusinessLogic
- {
- string conStr = ConfigurationManager.ConnectionStrings["myTaylorWoodrowSQL"].ConnectionString;
- public int CheckUserLogin(User User)
- {
- //Check the user is valid!!!!
- using (SqlConnection conObj = new SqlConnection(conStr))
- {
- SqlCommand comObj = new SqlCommand("retrieveUserByNameAndPassword", conObj);
- comObj.CommandType = CommandType.StoredProcedure;
- comObj.Parameters.Add(new SqlParameter("@Username", User.Username));
- comObj.Parameters.Add(new SqlParameter("@Password", User.UserPassword));
- conObj.Open();
- return Convert.ToInt32(comObj.ExecuteScalar());
- }
- }
- }
- }
- <script>
- $("#Login").click(function ()
- {
- var dataObject = { UserName: $("#UserName").val(), Password: $("#Password").val() };
- $.ajax({
- url:'@Url.Action("Login","User")',
- type:"POST",
- data: dataObject,
- datatype: "json",
- success: function(result)
- {
- if(result.toString()=="Success")
- {
- alert(result);
- }
- else
- {
- alert(result);
- }
- },
- error: function (result)
- {
- alert("Error");
- }
- });
- })
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement