Hello! Please tell me what is wrong? If I send data using standard tools, registering the action attribute, then zayavka.php is executed; if I send via ajax, nothing happens. There is a form that must be checked before being sent to the server, after which, if everything is all right, send the data to another page - zayavka.php. Do I understand correctly that after sending ajax data, the zayavka.php page will start and execute all the code it contains? Is it necessary at the beginning to put a condition that if such and such data has come to us, then we do this and that?
$ (function () {
if (( document.anketa.vid_kredita.selectedIndex == 2) && ( document.anketa.obekt_nedvizhimosti[1].checked == true )) { $("#vid_kredita").css('border', 'red 1px solid'); error=3; } if ( ( document.anketa.region.selectedIndex == 1) && ( parseInt(razm_kredita) < 600000 ) ) { $("#razmer_kredita").css('border', 'red 1px solid'); error=4; } if(error==0){ var data = $('#firstname').val(); $.ajax({ type: "POST", url: "/stat/zayavka.php", data: "data="+data, success: function(html) { $("#result").empty(); $("#result").append(html); } }); } else{ if(error==3) err_text="Текст ошибки 3"; if(error==4) err_text="Текст ошибки 4"; $("#messenger").html(err_text); $("#messenger").fadeIn("slow"); }