Hello, please tell me how you can send this form.

<form action='' method='post' id="сom" class="private" > <select name='privacy' class="black"> <option value=''>Выбрать</option> <option value="0"<?php if ($myrow2['privacy']==0) echo 'selected="selected"';?>>Да</option> <option value="1"<?php if ($myrow2['privacy']==1) echo 'selected="selected"';?>>Нет</option> </select> <input type="button" onclick="komm();" value="ОТПРАВИТЬ"> </form> <script> function komm(){ $.ajax({ type: "POST", url: "save_users.php?id=<?=$myrow2[id]?>", data: $("#сom").serialize(), success: function(data){ $("#resultprivate").html(data); } }); return false; }; </script> Без кнопки submit. 
  • one
    And what happens now when you press the "SEND" button? - iterq
  • Sending ajax to file save_users.php OnChange = 'user_mode.submit ();' But sending ajax is no longer coming. - andreykartavtsev
  • In theory, she should now go. I would do something like this. $ ("# com input [type = button]"). click (function () {komm ();}); - iterq
  • So, I apologize, I can not understand. Need ajax sending this form or normal? You wrote: "Ajax is being sent to the save_users.php file", didn’t you have achieved this by creating the komm function? - iterq
  • @iterq No, everything works fine, but only if the user selects something and presses the send button, and I need to send the form without a button, that is, the user chose something and immediately sent the file without pressing the button. - andreykartavtsev

1 answer 1

 $("select.black").change(function() { alert("Changed!"); }); 
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <form id="сom" class="private"> <select name='privacy' class="black"> <option value=''>Выбрать</option> <option value="0">Да</option> <option value="1">Нет</option> </select> <input type="button" id="send_form" value="ОТПРАВИТЬ" /> </form> 

Here I made an alert to change, but instead you can just write komm (); and send the form to change the select