I'am working on angularjs project in which there are 2 users admin and office staff.And to insert data to database i need to send data to server using http request using post method and this request is received on server side in php. This is simple request to server with some parameters and its working correctly until both the users hit submit button and http request is made at the same time. ie when http request is made by both the users at the same time.If that happens than 2nd request is does not get any response.Now my question is that is there a way to check if server is processing one http request and make 2nd request wait.
angularjs:
$http({
method: "post",
url: $localStorage.weburl + "abc.php?f=abc_data",
timeout: 1 * 10 * 2000,
params: {
action: "add"
},
data: {
data1: data1,
data2: data2
}.then(function mySucces(response) {
}, function myError(err) {
$ionicLoading.hide();
alert("Please check the connection");
})
});
PHP:
function abc_data($conn)
{
$_POST = json_decode(file_get_contents('php://input'), true);
}