Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- JQuery AJAX response handling
- $('#drop').click(function(e) {
- e.preventDefault();
- $('#login').slideToggle(1000);
- });
- $('#sub').click(function(e) {
- e.preventDefault();
- $('#info').html('<img src="img/load.gif" />')
- $.post('login.php', {user: document.getElementById('user').value, pass: document.getElementById('pass').value}, function(response) {
- if (response == 'ok')
- {
- $('#login').slideUp(500);
- $('#info').html('');
- $('#joocy').html('<img src="img/load.gif" />').load('manage.php');
- }
- else if (response == 'error')
- {
- $('#info').html('Invalid user/pass');
- }
- });
- });
- if ($row = mysql_fetch_array($result))
- {
- echo 'ok';
- }
- else
- {
- echo 'error';
- }
- $.post('login.php', {user: document.getElementById('user').value, pass: document.getElementById('pass').value}, function(response) {
- if (response == 'ok')
- {
- $('#login').slideUp(500);
- $('#info').html('');
- $('#joocy').html('<img src="img/load.gif" />').load('manage.php');
- }
- else if (response == 'error')
- {
- $('#info').html('Invalid user/pass');
- }
- var tmpText = "" + response.length + ": ";
- for(var tmpI=0; tmpI<response.length; tmpI++) {
- tmpText += response.charCodeAt(tmpI) + " ";
- }
- $("<fieldset></fieldset>").text(tmpText).appendTo("#info");
- });
- if($.trim(response)==='error')
- {
- //
- }
Add Comment
Please, Sign In to add comment