Weitere ähnliche Inhalte
Ähnlich wie Jquery for post a form (20)
Kürzlich hochgeladen (20)
Jquery for post a form
- 1. JQUERY FOR POST A FORM
Step -1: Create a html form
<html>
<title>Jquery form Post</title>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script type="text/javascript">
function send()
{
$.ajax({type:'POST', url:'process.php', data:$("#test_form").serialize(),
success:function(response){$("#result").html(response)}});
return false;
}
</script>
<style type="text/css">
.result {
padding:2px;
background-color:#99CCFF;
font-family:Arial, Helvetica, sans-serif;
font-size:12px;
font-weight:bold;
height:20px;
width:300px;
margin-top:12px;
padding-left:6px;
- 2. }
</style>
</head>
<body>
<form id="test_form" onsubmit="return send()">
<div>Name: <input type="text" name="name" /></div>
<div><input type="submit" value="send" /><div id="result"></div></div>
</form>
</body>
</html>
Step -2: Create a process file
Process.php
<?php
echo “Yoour posted data : ”.$_POST[‘name’];
?>
Now run the page