Jquery Ajax Requests
Jquery ajax requests are easier to perform as most of the legwork is already done for you.
You simply make the data you want to send in an object like this
var data_to_send = {"thetime":"18:30"};
this is represented as post data key/data pairs.
so “thetime” is the key and “18:30” is the data. Once you have the data you can start the actual request.
var data_to_send = {"thetime":"18:30"}; $.ajax({ url: "http://localhost/myfile.php", // the url you want to request data: data_to_send, // the data you want to send error: function() { // what you will do on a failed request console.log("error"); }, success: function(data) { //what you want to do on success console.log(data); }, type: 'POST' });
If you want to learn more you can go straight to http://api.jquery.com/jquery.ajax/ for more information and a larger example set.