<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US">
<head profile="http://gmpg.org/xfn/11">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>jQuery AJAX arrays</title>
<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
// $('your selector').click(function(e){
// e.preventDefault();
// your statements;
// });
// you can use the above or the one shown below
$('#myButton').bind("click",function()
{
// alert( "Handler for .click() called." );
var data =
{
foo: 123,
bar: 456,
rows:
[{
column1: 'hello',
column2: 'hola',
column3: 'bonjour',
},
{
column1: 'goodbye',
column2: 'hasta luego',
column3: 'au revoir',
},
{
column1: 'hello',
column2: 'hola',
column3: 'bonjour',
},
{
column1: 'goodbye',
column2: 'hasta luego',
column3: 'au revoir',
}],
test1:
{
test2:
{
test3: 'abcdef'
}
}
}
$.ajax
({
type: 'post',
cache: false,
url: 'esempio_7.php',
data: data,
success: function(response) { $('#myDiv').html(response); },
error: function() { alert("malfunzionamento ajax"); }
});
});
});
</script>
</head>
<body>
<input id="myButton" type="button" style="width: 130px; height: 60px" value="send AJAX" />
<br /> <br />
<div id="myDiv"> </div>
</body>
</html>