dixit la doc jquery
This method is the simplest way to fetch data from the server. It is roughly equivalent to $.get(url, data, success)
mais tests à l'appui c'est du post avec un json en data !!


code de limix429
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/*PAGE 1*/
 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script src="scripts/jquery-1.6.2.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
$(document).ready(function() {
 
	$('#divessai').load('test.php', {essai: 'alors?'});
 
});
</script>
</head>
<body>
 
	<div id="divessai"></div>
 
</body>
</html>
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
 
 
/*PAGE 2 : test.php*/
<?php
if (isset($_POST['essai']))
{
	echo "<h1>ça marche</h1>";
}
else{
	echo "<h1>ça marche pas</h1>";
}
???

Example: pass arrays of data to the server.

$("#objectID").load("test.php", { 'choices[]': ["Jon", "Susan"] } );

Example: Same as above, but will POST the additional parameters to the server and a callback that is executed when the server is finished responding.

$("#feeds").load("feeds.php", {limit: 25}, function(){
alert("The last 25 entries in the feed have been loaded");
});
Un array => get
Un json => post

????