doforumda Posted February 10, 2010 Share Posted February 10, 2010 hi i need help in adding preloader to ajax code. 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 <!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> script.js 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); } } login.html <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> login.php <?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!"); } ?> Link to comment https://forums.phpfreaks.com/topic/191575-need-help-in-adding-preloader-to-ajax-code/ Share on other sites More sharing options...
doforumda Posted February 10, 2010 Author Share Posted February 10, 2010 i am still waiting Link to comment https://forums.phpfreaks.com/topic/191575-need-help-in-adding-preloader-to-ajax-code/#findComment-1009914 Share on other sites More sharing options...
doforumda Posted February 10, 2010 Author Share Posted February 10, 2010 my problem is still unsolved please help Link to comment https://forums.phpfreaks.com/topic/191575-need-help-in-adding-preloader-to-ajax-code/#findComment-1010019 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.