0

MY FORM:

  <tfoot>
      <form method="post" action="kategoriler.php">
    <tr>
     <th>Select</th>
     <th><input type="text" name="id" id="id" class="form-control" style="width:80px;" placeholder="#"></th>
     <th>Image</th>
     <th><input type="text" name="name" id="name"  class="form-control" style="width:120px;" placeholder="Name"></th>
     <th>Order</th>
     <th><input type="text" name="Visibility" id="Visibility" class="form-control" style="width:120px;" placeholder="Visibility"></th>
     <th>Date</th>
     <th>Edit</th>
    </tr>
     </form>
  </tfoot>

I want to post this values with json and onkeyup functions how can i send this form values ?

Wanna Coffee
  • 2,742
  • 7
  • 40
  • 66
Gökhan Çokkeçeci
  • 1,388
  • 3
  • 16
  • 37

3 Answers3

1

Use jQuery ajax for that :

$(document).keydown(function(e) {
    $.ajax({
              type: "POST",
              dataType: "json",
              url: "kategoriler.php",
              data: {name: $('#name').val() //ETC...},
              success: function (html) {
                 alert('ok');
              }
         });
    });
Clément Andraud
  • 9,103
  • 25
  • 80
  • 158
1

This works add keyup function on all input type in a form

$('form input:text').keyup(function(){
      var data = $("form").serialize();
      $.ajax({
        url: 'kategoriler.php',
        data: data,
        dataType:'json',
        type:'POST',
        async:false,
        success: function(data) {
          alert('submitted');
        }
});

If you want to add keyup on a specific input type then just replace

$('form input:text').keyup(function(){

With

$('#id').keyup(function(){
code_rum
  • 872
  • 6
  • 21
0

you can do it like this. Provided that you whant to submit the form at any keyup

 //trigger form submit
 $(document).keyup(function(){
     $("form").submit();
 });

 //Do what you whant with your form
 $("form").submit(function(){
     //Do something eg. ajax call
      $.ajax({
           type: "POST",
           dataType: "json",
           url: "kategoriler.php",
           data: {name: $('#name').val() //ETC...},
           success: function (html) {
              alert('ok');
           }
      });
 });
Philip G
  • 4,098
  • 2
  • 22
  • 41