1One good practice is to use like this:
2
3$.ajax({
4 type: "POST",
5 url: "/ajax/request.html",
6 data: {action: 'test'},
7 dataType:'JSON',
8 success: function(response){
9 console.log(response.blablabla);
10 // put on console what server sent back...
11 }
12});
13and the php part is:
14
15<?php
16 if(isset($_POST['action']) && !empty($_POST['action'])) {
17 echo json_encode(array("blablabla"=>$variable));
18 }
19?>