note 107551 modified in faq.html by danbrown

From: Date: Thu, 10 May 2012 20:46:23 +0000
Subject: note 107551 modified in faq.html by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-187836@lists.php.net to get a copy of this message
Using jquery is even easier to send (post) data between javascript and php

<?php
//make an asynchronous request
$.post("somefile.php", {"Param1" : true, "Param2" : 1, "Param3" : "some text"}, 
 function(received_data)
 {
 //do something with received data
 $("#some_element").html(received_data);
 });

//make a post request
$.ajax({
 type: "POST",
 url: "somefile.php",
 data: {"Param1" : true, "Param2" : 1, "Param3" : "some text"},
 success: function(received_data)
 {//do something with received data},
 async: false
});
?> --was-- Using jquery is even easier to send (post) data between javascript and php //make a post request $.post("somefile.php", {"Param1" : true, "Param2" : 1, "Param3" : "some text"}, function(received_data) { //do something with received data $("#some_element").html(received_data); }); //make an asynchronous post request $.ajax({ type: "POST", url: "somefile.php", data: {"Param1" : true, "Param2" : 1, "Param3" : "some text"}, success: function(received_data) {//do something with received data}, async: false }); http://php.net/manual/en/faq.html.php

« previous php.notes (#187836) next »