hi i need help in adding preloader using jquery. in the following code i want to add preloader when user clicks on Tab One and also when user enter its username and password and after pressing submit button there i want to add preloader. i have a loader.gif image so please help me how and where can i add it loginTab.html [code]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <link rel="stylesheet" href="style.css"/> </head>
<body> <div class="tabs" onclick="tabOne()">Tab One</div> <div id="message"></div> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script> <script type="text/javascript" src="script.js"></script> </body> </html> [/code] script.js [code]function tabOne() { $('div#message').load('login.html'); } function login () { var url = 'login.php'; var user = $('input#user').val(); var pass = $('input#pass').val(); var queryString = 'user=' + user + '&pass=' + pass; $.post(url,queryString,display); function display(data) { $("#content").html(data); } } [/code] login.html [code]<div id="content"></div> <form> Username:<br /> <input type="text" name="user" id="user" /><br /> Password:<br /> <input type="password" name="pass" id="pass" /><br /> <input type="button" name="submit" id="submit" value="Login" onclick="login()" /> </form>[/code] login.php [code]<?php $email = strip_tags($_POST['user']); $password = strip_tags($_POST['pass']); //echo $email; //echo $password; if($email&&$password) { $connect = mysql_connect("localhost","user","pass"); mysql_select_db("facebook"); $query = mysql_query("SELECT email FROM users WHERE email='$email'"); $count = mysql_num_rows($query); if($count == 0) { echo "You are registered thanks."; } else { die("That email address already exist."); } } else { die("please fill in both fields!"); } ?>[/code] -- View this message in context: http://old.nabble.com/need-help-in-adding-preloader-using-jquery-tp27526216s27240p27526216.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.