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 :- - Hallo sahabat Tutorials, Pada Artikel yang anda baca kali ini dengan judul How to pass data from html form to php file on server using jquery $.ajax :-, kami telah mempersiapkan artikel ini dengan baik untuk anda baca dan ambil informasi didalamnya. mudah-mudahan isi postingan yang kami tulis ini dapat anda pahami. baiklah, selamat membaca.

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 :-

Baca juga


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