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 ?

5
  • with onkeyup event ? very bad idea Commented Feb 14, 2014 at 13:19
  • whats your idea ? im not good at jquery Commented Feb 14, 2014 at 13:20
  • You can use jQuery.ajax() Commented Feb 14, 2014 at 13:21
  • stackoverflow.com/questions/11482939/… Commented Feb 14, 2014 at 13:22
  • I try ajax but i will use this method on search i want to process with key by key Commented Feb 14, 2014 at 13:22

3 Answers 3

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(){
Sign up to request clarification or add additional context in comments.

2 Comments

how can i get this values on kategoriler.php for example i sent name but i cant take this name other page
using $_POST...like $all_input_values = $_POST and then $all_input_values['id'] this will get you id value..use same for others
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');
              }
         });
    });

2 Comments

onkeyup op want to submit the form on this event.
This method will work when i press any button ?
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');
           }
      });
 });

4 Comments

I have no submit button i want to process when i press any button ?
Ok. but isn't that a problem when the user are typing things in your textfield? That would mean that the form getssubmitted for every character. In my opinion it would be more convinient with onChange().
How can i get this values :)
trigger submit with change() instead of keyup(). You can get the values in the same maner as described in the other posts

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.