How to send the value and request data to other page in ajax and jquery

HTML, PHP 0 Comments
tutorial-for-ajax-php

How to define the variable in ajax and jquery step by step.How to pass the multiple values through ajax jquery MySQL PHP and apply the multiple conditions in ajax and jquery  in PHP and how to implement the ajax and jquery  in PHP.How to send the value one file to another file by ID and class

 

Syntex of variable in ajax and jquery in PHP

var emailid = $(“#emailid”).val();

Daily Visit GK on myshort.in

#emailid : ID

.emailid : Class also used.

var emailid : Any name used in emailid such as email, mail etc because this is a variable.

 

Send and pass the value one file to another file  through POST and GET function with  the URL show in the given program

$.post(“action.php”,{email: emailid  },function(data){ })

 

 

Exaple of define the variable in ajax and jquery in php

<script type = “text/javascript” >

$(document).ready(function(){

$(“#sub”).click(function() {

var emailid = $(“#emailid”).val();   // defined the variable in jquery

$.post(“action.php”,{email: emailid  },function(data){

//  meaning of this line is now we are pass 3rd  parameter and send the value to next page in the form of post “,{email: emailid  }, you can any name used to ‘email ‘ because it is variable

$(“#result”).html(data);

});

});

});

</script>

—————————–

Full program 

Index.php it is main page

<html>

<head>

<title>The jQuery Example</title>

<script type = “text/javascript” src = “https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js”></script>

<script type = “text/javascript” >

//            Jquery synatx

$(document).ready(function(){

$(“#sub”).click(function() {

var emailid = $(“#emailid”).val();

 

$.post(“action.php”,{email:emailid},function(data){

 

$(“#result”).html(data);

});

});

});

</script>

</head>

<body>

<div class=”container”>

<div class=”main”>

<form  method=”POST” name=”form” action=””>

<input type=”text” name=”emailid” value=”” id=”emailid”/> <br />

<input type=”button” value=”submit” name=”sub” id=”sub”/>

</form>

</div>

<div id=”result” ></div>

</div>

</body>

</html>

 

2nd  page is action.php

<?php

echo $_POST[’email’];

?>

 

Click and Download the program code file 

 

 

Buy online Rajasthan gk book Railway JE CBT REET PAtwari Book SSC CGL Clerk GD Book Buy online Rajasthan gk book Railway JE CBT REET PAtwari Book SSC CGL Clerk GD Book

Best Book for Railway vacancies: 130000 Job Non-Technical CBT Question Bank competition all Exam: Rajasthan gk book Railway JE CBT REET PAtwari Book SSC CGL Clerk GD Book Buy online Rajasthan gk book Railway JE CBT REET PAtwari Book SSC CGL Clerk GD Book

Best Book for Railway vacancies: 130000 Job Non-Technical CBT Question Bank competition all Exam:

https://amzn.to/2CfZxnu

General Science GK in Hindi and English Samanya Vigyan for Bhartiya Railways RRB

https://amzn.to/2UAZABs

https://amzn.to/2TyikFe

General Science in English for RRB Junior Engineer, NTPC, ALP & Group D Exams

https://amzn.to/2CibCIN

Best Book for Rajasthan Police LDC Patwar RAS Level and Rajasthan competition all Exam:

Rajasthan History Rajasthan ka itihas Kala Sanskriti Best Book

https://amzn.to/2F8EKnC

https://amzn.to/2XTvniO

Rajasthan Economy Best Book for all competition Exam:

https://amzn.to/2XTLAVj

Rajasthan Geography Best book for all competition Exam:

https://amzn.to/2CkWgmS

Indian political, economics, geography Best Book for IAS RAS 1st 3nd 3rd grade teacher and all exam all Exam in hindi and english

Indian political book: https://amzn.to/2T2Ckuf

Indian political book: https://amzn.to/2CeJTbO

Indian economics book: https://amzn.to/2NYYBIy

Indian history book english: https://amzn.to/2T5uK1X

Indian history book hindi: https://amzn.to/2Ciwhw2

Ecology and Environment book: https://amzn.to/2ESjdOs

World geography book Best Book for IAS RAS 1st 3nd 3rd grade teacher and all exam all Exam in hindi and english

World geography book: https://amzn.to/2CcGMBh

world history: https://amzn.to/2T2wQQg

Best book for Indian history in hindi by Krishna Reddy (Author) and world history

share..Share on Facebook0Share on Google+0Tweet about this on TwitterShare on LinkedIn0