Advertisement
Guest User

Untitled

a guest
Mar 2nd, 2016
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.90 KB | None | 0 0
  1. Unhandled exception at line 133, column 5 in http://localhost:49647/Account/Login
  2.  
  3. 0x800a1391 - JavaScript runtime error: '$' is undefined
  4.  
  5. using System;
  6. using System.Data.SqlClient;
  7. using System.Data;
  8. using System.Configuration;
  9.  
  10. namespace Login.BL
  11. {
  12. public class User
  13. {
  14. public int UserID { get; set; }
  15. //[Required]
  16. public int Username { get; set; }
  17. //[Required]
  18. public int UserPassword { get; set; }
  19.  
  20. }
  21. public class UserBusinessLogic
  22. {
  23. string conStr = ConfigurationManager.ConnectionStrings["myTaylorWoodrowSQL"].ConnectionString;
  24. public int CheckUserLogin(User User)
  25. {
  26. //Check the user is valid!!!!
  27. using (SqlConnection conObj = new SqlConnection(conStr))
  28. {
  29. SqlCommand comObj = new SqlCommand("retrieveUserByNameAndPassword", conObj);
  30. comObj.CommandType = CommandType.StoredProcedure;
  31. comObj.Parameters.Add(new SqlParameter("@Username", User.Username));
  32. comObj.Parameters.Add(new SqlParameter("@Password", User.UserPassword));
  33. conObj.Open();
  34. return Convert.ToInt32(comObj.ExecuteScalar());
  35. }
  36. }
  37. }
  38. }
  39.  
  40. <script>
  41. $("#Login").click(function ()
  42. {
  43. var dataObject = { UserName: $("#UserName").val(), Password: $("#Password").val() };
  44. $.ajax({
  45. url:'@Url.Action("Login","User")',
  46. type:"POST",
  47. data: dataObject,
  48. datatype: "json",
  49. success: function(result)
  50. {
  51. if(result.toString()=="Success")
  52. {
  53. alert(result);
  54. }
  55. else
  56. {
  57. alert(result);
  58. }
  59. },
  60. error: function (result)
  61. {
  62. alert("Error");
  63. }
  64. });
  65. })
  66. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement