HTML & Ajax not working as expected
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: HTML & Ajax not working as expected

  1. #1
    Join Date
    Oct 2008
    Posts
    17

    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>

  2. #2
    Join Date
    Jun 2009
    Posts
    103

    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);

  3. #3
    Join Date
    Feb 2018
    Location
    LUCKNOW
    Posts
    4

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)