I think, that a lot of people who build sites, sometimes have a question: “How to send information and put results in a page without reloading?”. In that post I will tell you about very usable thing  –  AJAX (Asynchronous Javascript and XML). It’s JavaScript library, which working with XML.

First we need to connect AJAX library to our project. You have two ways: use CDN (you don’t need to download anything, just put one link to remote library into your HTML file) of it or download the library and link it into head of HTML. For first variant (CDN) you need to insert that code :

<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>

 

For the second variant  you need the latest version of library on that page, then  put that file into your project folder and link it using script tag, like that:

<script src="https://code.jquery.com/jquery-3.1.1.min.js"> </script>

Then, of course JS code:

function funcSuccess(data){$("#actions_list").html (data);} //We will call that function if we successfully sent data
var action = "queue_show"; //Declarating variable
$.ajax({; //Opening AJAX
url: "actions_listener.php", //URL of page, where we will send the data
type: "POST", //Type of sending data GET or POST
data: ({action: action}), //Variables which we will send
dataType: "html", //Which type of data will we recieve html or text
success: funcSuccess /*Event of success finish (If we sent info successfully let's start function funcSuccess)*/
})

Later I will post more detailed post about AJAX