$(function(){$('form.my_form').submit(function(event){
event.preventDefault();// Prevent the form from submitting via the browservar form =$(this);
$.ajax({type: form.attr('method'),url: form.attr('action'),data: form.serialize()}).done(function(data){// Optionally alert the user of success here...}).fail(function(data){// Optionally alert the user of an error here...});});});
// First add jquery// <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>$(document).ready(function(){$("#myForm").on('submit',(function(e){
e.preventDefault();
$.ajax({url:$(this).attr('action'),type:"POST",data:newFormData(this),contentType:false,cache:false,processData:false,success:function(response){$("#myForm").trigger("reset");// this line is to reset form input fieldsalert('submitted');},error:function(e){alert('Failed to sumit');}});}));});//don't forget to add csrf token
$(document).on('click','#save_province',function(){var a =$("#province").val(), b =$("#district").val(), c =getParameterByName('supplier_id');
$.ajax({url:"postavshik_save.php",type:"POST",data:{province: a,district: b,supplier_id: c,},beforeSend:function(){$("#province").attr("disabled",!0),$("#district").attr("disabled",!0);},success:function(a){alert("Post so`rov yuborildi javob olindi");}});});