I have a html form to make an order in a shop by clicking a button called Order
.(button_id="order") At the button click event i have performed a ajax request to a page(itemOrder_php2.php) which sends some data in the form to that mentioned page. It's working correctly. But the problem is ajax request is not functioning when two or more users order at the same time. Please help me to work with multiple ajax requests. Thank you! here is my code.
$(document).ready(function(){
$("#order").click(function(e){
e.preventDefault();
$.ajax({type: "POST",
url: "itemOrder_php2.php",
data: { selectedItem: $("#selectedItem").val(), sizeUnit: $("#sizeUnit").val(), quantity: $("#quantity").val(), value: x, lSize : $("#lSize").val(), lPrice : $("#lPrice").val() },
success:function(result){
$("#orderResult").html(result);
}});
});
});
Handle the click event with document on...
$(document).ready(function(){
$(document).on('click','#order',function(e){
e.preventDefault();
$.ajax({type: "POST",
url: "itemOrder_php2.php",
data: { selectedItem: $("#selectedItem").val(), sizeUnit: $("#sizeUnit").val(), quantity: $("#quantity").val(), value: x, lSize : $("#lSize").val(), lPrice : $("#lPrice").val() },
success:function(result){
$("#orderResult").html(result);
}});
});
});