You can use jQuery.ajax()and set the parameter asyncto false:
async Default: true By default, all requests are sent asynchronously (i.e. by default, this value is true). If you need synchronous requests, set this parameter to false. Cross-domain requests and dataType: "jsonp" requests do not support synchronous operation. Please note that synchronous requests may temporarily block the browser, disabling any actions while the request is active
You can use it as follows:
$.ajax({
type: "POST",
url: "file.php",
async: false,
data: data,
success: function(return){
alert("Success: "+return);
}
});
If you want to add a bootloader, just apply it as:
startLoader();
$.ajax({
type: "POST",
url: "file.php",
async: false,
data: data,
success: function(return){
alert("Success: "+return);
}
});
endLoader();
, PHP-, . script. : ?
, :
processes . 2 :
: process_id; : process_status. - , sha1 (IMAGE).
: 1 "", 0 "".
- :
SELECT process_status FROM vps_processes WHERE process_id = sha1(CURRENT_IMAGE);
, 1 0. 1, script; 0, :
UPDATE vps_processes SET process_status = 1 WHERE process_id = sha1(CURRENT_IMAGE);
, , script:
UPDATE vps_processes SET process_status = 0 WHERE process_id = sha1(CURRENT_IMAGE);