DIR : /home/kozerus/public_html/ajaxjs.html

/home/kozerus/public_html

<!DOCTYPE html>
<html>
<head>
<title>Submit Form Using AJAX PHP and javascript</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<link href="css/style.css" rel="stylesheet">
<script src="script.js"></script>

	<script id="script_ajaxjs_js" >
		function myFunction() {
			var name = document.getElementById("name").value;
			var email = document.getElementById("email").value;
			var password = document.getElementById("password").value;
			var contact = document.getElementById("contact").value;
// Returns successful data submission message when the entered information is stored in database.
			var dataString = 'name1=' + name + '&email1=' + email + '&password1=' + password + '&contact1=' + contact;
			if (name == '' || email == '' || password == '' || contact == '') {
				alert("Please Fill All Fields");
				} 
			else {
// AJAX code to submit form.
				$.ajax({
					type: "POST",
					url: "ajaxjs.php",
					data: dataString,
					cache: false,
					success: function(html) {
						alert(html);
						}
					});
				}
			return false;
			}
		</script>


</head>


<body bgcolor=linen>
	<div id="mainform">
		<div class="innerdiv">
			<h2>ajaxjs submit form</h2>


<!-- Required Div Starts Here -->
			<form id="form" name="form">
				<h3>Information!</h3>
				<div id="div_form_labels" >>
					<label>Name :</label>
					<input id="name" type="text">
					<label>Email :</label>
					<input id="email" type="text">
					<label>Password :</label>
					<input id="password" type="password">
					<label>Contact No :</label>
					<input id="contact" type="text">
					<input id="submit" onclick="myFunction()" type="button" value="Submit">
					</div>
				</form>
			<div id="clear"></div>
			</div>

		<div id="clear"></div>
		</div>

	</body>
	</html>

//


koh5_pano



Your browser does not support the HTML5 canvas element.


Drag mouse to navigate.

Navigation





17.Aug.2010, Martin Wengenmayer