AJAX
Asynchronous JavaScript and XML ( AJAX ) is not a technology by itself, it is a term that describes a new way of using together several existing technologies. This includes: HTML or XHTML, CSS, JavaScript, DOM, XML, XSLT, and the XMLHttpRequest object. When these technologies are combined in an AJAX model, it is possible to achieve web applications capable of continuously updating without having to reload the entire page. This creates faster applications with better response to user actions.
What is AJAX?
AJAX (Asynchronous JavaScript and XML) is a new term to describe two capabilities of browsers that have been present for years, but that had been ignored by many Web developers, until recently that applications such as Gmail, Google suggest and Google Maps.
The two capacities in question are:
- The ability to make requests to the server without having to reload the page.
- The possibility to analyze and work with XML documents.
javascript
//arrays
var array1 = ['1','2']
var array2 = ['3','4']
//variables
var variable1 = "hola mundo1"
var variable2 = "hola mundo2"
/*JSON a Enviar*/
var datos = {
'array1':array1,
'array2':array2,
'variable1':variable1,
'variable2':variable2
}
$.ajax({
type: "POST",
url: "saveAsistencia.php",
data: datos,
dataType: "json",
error: function(){
alert("error al hacer consulta");
},
success: function(data){
$("#response").empty();
$("#response").append(data);
}
});
}
PHP
<?php
echo $_GET["array1"]
?>
The data of the success should show the same array that you passed as a parameter I hope you help greetings