HTML & Ajax not working as expected
Please tell me why the following html does not call the javascript submit_click() function.
Code:
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<link rel="stylesheet" type="text/css" href="style/style.css"/>
<script language="JavaScript" type="text/javascript" src="js/Diva.js"></script>
<style type="text/css">a {text-decoration: none}</style>
<script language=javascript>
function submit_click()
{
alert("Button Pressed");
progExe("logon.php?"uname="+uname+"&Passwrd="+passwrd);
}
</script>
</head>
<body>
<!--- <form name="logon" ID="logon" action="logon.php" method="post"> -->
<table align="center" border="3" cellspacing="0" cellpadding="3">
<tr><td>Username:</td><td>
<input type="text" name="uname" id=uname maxlength="40" placeholder="Enter your UserName" autofocus required>
</td></tr>
<tr><td>Password:</td>
<td>
<input type="password" name="passwrd" id=passwrd maxlength="50" placeholder="Password" required>
</td></tr>
<tr><td colspan="3" align="center">
<button type="button" onclick="submit_click()">Logon</button>
<a href="register.html"><input type=submit value="RegisterSelf">
<a href="client.html"><input type=submit value="RegisterClient">
</td></tr>
</table>
<center>
<div id="loadingNode";></div>
</center>
</body>
</html>
Re: HTML & Ajax not working as expected
You have a bug in the line:
Code:
progExe("logon.php?"uname="+uname+"&Passwrd="+passwrd);
It should probably be something like:
Code:
progExe("logon.php?uname="+uname+"&Passwrd="+passwrd);
Re: HTML & Ajax not working as expected
Use jQuery Ajax Method in your code since you can put the alert inside the error area. This will hep you to easily find what is going wrong on your code.