ȸ¿ø°¡ÀԡžÆÀ̵ð/ºñ¹øã±â
ȨÀ¸·Î


jQuery AJAX ·Î±×ÀÎ ±¸Çö
8³â Àü

login.php

<!DOCTYPE html>
<meta charset="utf-8" />
<title>jQuery ·Î±×ÀÎ</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
	$("#login").click(function() {
		var action = $("#form1").attr('action');
		var form_data = {
			user_id: $("#user_id").val(),
			user_pw: $("#user_pw").val(),
			is_ajax: 1
		};
		$.ajax({
			type: "POST",
			url: action,
			data: form_data,
			success: function(response) {
				if(response == 'success') {
					$("#message").html("<p style='color:green;font-weight:bold'>·Î±×ÀÎ ¼º°ø!</p>");
					$("#form1").slideUp('slow');
				}
				else {
					$("#message").html("<p style='color:red'>¾ÆÀ̵ð ¶Ç´Â ºñ¹Ð¹øÈ£°¡ À߸øµÇ¾ú½À´Ï´Ù.</p>");	
				}
			}
		});
		return false;
	});
});
</script>
<body>
<form id="form1" name="form1" action="login_ok.php" method="post">
<table>
<tr>
	<td>¾ÆÀ̵ð</td>
	<td><input type='text' id='user_id' name='user_id' tabindex='1'/></td>
	<td rowspan='2'><input type='button' id='login' tabindex='3' value='·Î±×ÀÎ' style='height:50px'/></td>
</tr>
<tr>
	<td>ºñ¹Ð¹øÈ£</td>
	<td><input type='password' id='user_pw' name='user_pw' tabindex='2'/></td>
</tr>
</table>
</form>
<div id="message"></div>
</body>

login_ok.php

<?php
if(!isset($_POST['is_ajax'])) exit;
if(!isset($_POST['user_id'])) exit;
if(!isset($_POST['user_pw'])) exit;
$is_ajax=$_POST['is_ajax'];
$user_id = $_POST['user_id'];
$user_pw = $_POST['user_pw'];
$members = array('user1'=>array('pw'=>'pw1', 'name'=>'Çѳð'),
        'user2'=>array('pw'=>'pw2', 'name'=>'µÎ½Ã±â'),
        'user3'=>array('pw'=>'pw3', 'name'=>'¼®»ï'));
 
if(!$is_ajax) exit;
if(!isset($members[$user_id])) exit;
if($members[$user_id]['pw'] != $user_pw) exit;
setcookie('user_id',$user_id);
setcookie('user_name',$members[$user_id]['name']);
echo "success";	
?>

¿¹Á¦

¡æ ¾ÆÀ̵ð¿Í Æнº¿öµå¸¦ ¾Æ¹«°Å³ª ÀÔ·ÂÇÏ¿© ·Î±×ÀÎÇغ»´Ù.
¡æ ¾ÆÀ̵ð user1, Æнº¿öµå pw1 À» ÀÔ·ÂÇÏ¿© Å×½ºÆ®
ÃßõÃßõ : 304 Ãßõ ¸ñ·Ï
¹øÈ£ Á¦¸ñ
1,222
ÇѱÛ, ÇÑÀÚ¸¦ À¯´ÏÄÚµå·Î º¯È¯Çϱâ
1,221
°æ·Î ºÐ¸®Çϱâ
1,220
ÇÑ±Û ASCII Äڵ带 À¥ URL¿¡¼­ »ç¿ëµÇ´Â UTF8 ÄÚµå·Î º¯È¯
1,219
Unicode (UTF-8) ÀÎÄÚµù¿¡¼­ ÇÑ±Û ±ÛÀÚ¼ö Ãâ·Â ¹× iconv substr
1,218
PHP¿¡¼­ À¯´ÏÄÚµå·Î ¹®ÀÚ¿­ ÀÎÄÚµùÇϱâ
1,217
[JavaScript] µÚ·Î°¡±â È÷½ºÅ丮°¡ ¾ø´Â °ÍÀ» ¾î¶»°Ô ¾Ë ¼ö ÀÖÀ»±î?
1,216
¹®ÀÚ¿­ ±ÛÀÚ ¼ø¼­ °Å²Ù·Î µÚÁý±â, ¾ÕµÚ ¹ÝÀü Reverse String
1,215
¹è¿­ ¿ä¼Ò ¼ø¼­ °Å²Ù·Î µÚÁý±â, ¾ÕµÚ ¹ÝÀü Reverse Array
1,214
php ¸Þ¸ð¸® »ç¿ë
1,213
ÀÚ¹Ù½ºÅ©¸³Æ® ³»ºÎ °´Ã¼ º¸±â
1,212
ÀÚ¹Ù ½ºÅ©¸³Æ® ¼ýÀÚ Ã³¸® ÄÞ¸¶ ó¸®
1,211
ÀÚ¹Ù½ºÅ©¸³Æ® Base64 encode, decode
1,210
PHP ¹®ÀÚ¿­ °ü·Ã ÇÔ¼ö
1,209
[php] ¹®ÀÚ¿­À» ³ª´©°Å³ª ÇÕÄ¡´Â explode, implode ÇÔ¼ö
1,208
php ¹®ÀÚ¿­ ÀÚ¸£±â ³ª´©±â ºÐ¸®Çϱâ - explode() , split()
1,207
PHP ¹®ÀÚ¿­ ³ª´©±â - explode()
1,206
[PHP] ¹è¿­ Array
1,205
php ¹è¿­
1,204
[php] Array() ¹è¿­À̶õ?
1,203
PHP ¹è¿­ ÇÔ¼ö Á¤¸®
1,202
PHP ±âº»ÀûÀÎ ¹è¿­ »ç¿ë¹ý
1,201
php set time limit ÇÔ¼ö - ŸÀӾƿô ¼³Á¤
1,200
´Ù¿î·Îµå Ƚ¼ö Á¦ÇÑ ½ºÅ©¸³Æ®
1,199
ÀÚ¹Ù½ºÅ©¸³Æ® ŸÀÌ¸Ó - setTimeout, setInterval, clearInterval ÇÔ¼ö
jQuery AJAX ·Î±×ÀÎ ±¸Çö
1,197
PHP ¼¼¼Ç ·Î±×ÀÎ ±¸Çö
1,196
PHP ÄíÅ° ·Î±×ÀÎ ±¸Çö
1,195
jQuery¿¡¼­ json º¯¼ö »ç¿ë(È°¿ë)¹ý
1,194
AJAX ¹Ýº¹Ã³¸® ¹× ¼³¸í ¿¹Á¦
1,193
[php] ¹è¿­À» ÀÓÀÇÀÇ ¼ø¼­·Î ¼¯´Â shuffle ÇÔ¼ö
¸ñ·Ï
¹ÂÁ÷Æ®·ÎÆ® ºÎ»ê±¤¿ª½Ã ºÎ»êÁø±¸ °¡¾ßµ¿ ¤Ó °³ÀÎÁ¤º¸Ãë±Þ¹æħ
Copyright ¨Ï musictrot All rights reserved.