Tuesday, 12 March 2019

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">
<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) {
// 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, 
// UI response after the file upload
success: function(data)

// Triggered when the image changed (browse)

// Function to show the image as a preview

<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" />


<div id="response">  </div>


(2)write code for pass.php file:-



echo $myname;


Written by

We are Creative Blogger Theme Wavers which provides user friendly, effective and easy to use themes. Each support has free and providing HD support screen casting.


PHP Training Mumbai, PHP MySQL Training Mumbai, PHP Course Mumbai, PHP Institute Mumbai


© 2013 PHP TRAINING IN MUMBAI BY OM SIR . All rights resevered. Designed by OM SIR

Back To Top