Judul : How to pass data from html form to php file on server using jquery $.ajax :-
link : How to pass data from html form to php file on server using jquery $.ajax :-
How to pass data from html form to php file on server using jquery $.ajax :-
Pass data from html form to php file on server using jquery $.ajax :-
Step 1:- Write code for form.html file:-
<!doctype html>
<html lang="en">
<head>
<title>passing form input value to php - BY OM SIR</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-2.1.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function (event) {
// triggered when the form submitted
$("#myform").submit(function(event) {
event.preventDefault();
$("#response").empty();
$.ajax({
// URL to move the uploaded image file to server
url: "pass.php",
// Request type
type: "POST",
// To send the full form data
data: new FormData(this),
contentType: false,
processData:false,
// UI response after the file upload
success: function(data)
{
$("#response").html(data);
}
});
});
// Triggered when the image changed (browse)
// Function to show the image as a preview
});
</script>
</head>
<body>
<label>passing form data to php file </label>
<form id="myform" action="" method="post" enctype="multipart/form-data">
<input type=text name=myname>
<input type="submit" value="pass" />
</form>
<div id="response"> </div>
</body>
</html>
(2)write code for pass.php file:-
<?php
$myname=$_POST['myname'];
echo $myname;
?>
Demikianlah Artikel How to pass data from html form to php file on server using jquery $.ajax :-
Sekianlah artikel How to pass data from html form to php file on server using jquery $.ajax :- kali ini, mudah-mudahan bisa memberi manfaat untuk anda semua. baiklah, sampai jumpa di postingan artikel lainnya.
Anda sekarang membaca artikel How to pass data from html form to php file on server using jquery $.ajax :- dengan alamat link https://othereffect.blogspot.com/2019/03/how-to-pass-data-from-html-form-to-php.html
0 Response to "How to pass data from html form to php file on server using jquery $.ajax :-"
Post a Comment