In client-server applications, there are two very frequent tasks:
Receiving data from the server
Sending data to the server
These tasks need some format for data exchange. One of the most popular ways is using the JSON format (http://json.org/).
Generally, you can use any mechanism for data exchange operations, ranging from sending XMLHttpRequest
and handling the response in pure JavaScript, to using third-party JS libraries and frameworks. It's very convenient to use the following jQuery's AJAX helper methods:
An example of data exchange is as follows:
// Receiving data from the server $.getJSON("http://myserver.com", function(data) { // Here you can use received data }) // Send data to the server $.post("http://myserver.com", data, function(returnedData) { // Successful callback }) // Using...