As a novice in web app development, I am currently working on creating a login page and retrieving user data from a local database using JavaScript. Despite my efforts, I seem to have made an error somewhere in my code. Below is the snippet of my JavaScript code:
$(document).ready(function () {
$("#log-in-form").on("submit", function (e) {
e.preventDefault();
var username = $(this).find("input[type=text]").val();
var password = $(this).find("input[type=password]").val();
Authentication(username, password);
});
function Authentication(username,password){
$.ajax({
type: "GET",
url: "../Web Service/LogIn.asmx/get_uinfos",
data: "{'domain':" + username + "', 'accountpassword':'" + password + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (response) {
var result = response.d;
var length = response.length;
$.each(result, function (index, data) {
var alias = data.alias;
window.localStorage.replace("Main.aspx");
});
},
error: function () {
alert('Function Error "get_uinfos"')
}
});
}
});
Additionally, I'm establishing connection with the local server through a web service using the following code:
using Wishlist_2017;
using System;
...
Upon attempting to log in by entering the username and password, I encountered an error visible on the console.
https://i.sstatic.net/yw6Cz.png
If anyone could provide guidance on where to troubleshoot this issue, it would be greatly appreciated.
EDIT 1:
This is the server-side class code:
using System;
using System.Collections.Generic;
...
The connection string is configured within my web.config file.
EDIT 2:
Below is the connection string as defined in my web.config:
<connectionStrings>
<add name="Server" connectionString="Data Source=(LocalDB)\ArnServer; initial Catalog=Wishlist; uid=sa; pwd=ordiz@2017!; Asynchronous Processing=true" providerName="System.Data.SqlClient"/>
</connectionStrings>