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;



Powered by Blogger.

Feature Post

About Me

My photo
B.E.(COMPUTER ENGINEER) PHP Web developer & Provide Training for Web Development , Digital Marketing ,Android Mobile Apps Development

Post Slider (Homepage)

Blog Archive


Transfer Files

Media Players

Download Manager


Torrents Soft

Developer Tools

Botton Ad




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

Back To Top