且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用JQuery检查html页面中的用户名和密码

更新时间:2022-10-23 14:25:00

你不能使用Javascript连接你的html网站。

,因为它是客户端脚本语言。它基本上只能用于接口和验证。

你应该使用ASP.net,JSP或Php与SQL Server数据库连接。

你可以查看

ASP.Net连接


你必须通过jquery和json执行ajax调用(客户端),也可以使用处理程序文件来实现你想要的。



我建议你通过以下链接:



什么是jquery ajax: http://api.jquery.com/jQuery.ajax/ [ ^ ]



5种使用jQuery进行Ajax调用的方法: http://net.tutsplus.com/tutorials/javascript-ajax/5-ways-to-make- ajax-calls-with-jquery / [ ^ ]



http://www.html.net/tutorials/javascript/lesson21.php [ ^ ]





希望这对您有所帮助,如果有任何疑问请告诉我。


这是使用HTML& amp;的示例代码。 JQuery:



< html> 
< head>
< meta charset =utf-8>
< title> jQuery验证插件示例< / title>

<! - 用于为演示页面设置样式的Bootstrap CSS - >
< link rel =stylesheethref =css / bootstrap.min.css>
< link rel =stylesheethref =css / style.css>
< / link>< / link>< / meta>< / head>

< body>
<! - 登录表单的基本验证 - >
< form class =formid =example1>
< div class =form-group>
< label>基本登录表单示例< / label>
< / div>
< div class =form-group>
< label for =example1-email>电子邮件地址< / label>
< input type =emailclass =form-controlid =example1-emailname =example1-emailplaceholder =enter email>
< / input>< / div>
< div class =form-group>
< label for =example1-password>密码< / label>
< input type =passwordclass =form-controlid =example1-passwordname =example1-passwordplaceholder =Password>
< / input>< / div>
< button type =submitclass =btn btn-primary>提交< / button>
< / form>

<! - 加载jQuery和jQuery-Validate脚本 - >
< script src =js / jquery.js>< / script>
< script src =http://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js>< / script>
< script>
//文档准备好后


Hi All,

i am using HTML page,java script and SQLServer2008.

i want to create connection string from sql2008 through JQuery.
how to create code for check user name and password in HTML page using sql2008 and JQuery.

any suggestion or helpful link . . .

Regard

Mukesh

You can'nt connect your html website using Javascript.
because it is client side scripting language.It can be used only for the interfaces and validations basically.
You should use ASP.net,JSP or Php for connection with SQL Server database.
you can check for
ASP.Net connection


You have to perform ajax calls (client side) through jquery and json and may be use handler files also to achieve what you want.

I suggest you go thru the below links:

What is jquery ajax: http://api.jquery.com/jQuery.ajax/[^]

5 Ways to Make Ajax Calls with jQuery: http://net.tutsplus.com/tutorials/javascript-ajax/5-ways-to-make-ajax-calls-with-jquery/[^]

http://www.html.net/tutorials/javascript/lesson21.php[^]


Hope this helps you, if any queries plz let me know.


This is the Sample Code using HTML & JQuery:

<html> 
    <head>
        <meta charset="utf-8">
        <title>jQuery Validation Plugin Examples</title>

        <!-- Bootstrap CSS used for styling the demo pages-->
        <link rel="stylesheet" href="css/bootstrap.min.css">
        <link rel="stylesheet" href="css/style.css">
    </link></link></meta></head>

    <body>
        <!-- basic validation of a login form -->
        <form class="form" id="example1">
            <div class="form-group">
                <label>Basic login form example</label>
            </div>
            <div class="form-group">
                <label for="example1-email">Email address</label>
                <input type="email" class="form-control" id="example1-email" name="example1-email" placeholder="Enter email">
            </input></div>
            <div class="form-group">
                <label for="example1-password">Password</label>
                <input type="password" class="form-control" id="example1-password" name="example1-password" placeholder="Password">
            </input></div>
            <button type="submit" class="btn btn-primary">Submit</button>
        </form>

        <!-- Load jQuery and jQuery-Validate scripts -->
        <script src="js/jquery.js"></script>
        <script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
        <script>
            // When the document is ready