There are 2 scripts:
The first one takes data from 2 forms and sends it to the handler (filter)

$(document).on('change','.sort_order',function(){ var url = "ajax/objects.php"; var dataString = $("#search_form, #order-form").serialize(); $.ajax({ type: "POST", url: url, data: dataString, success: function(data) { $('.ajax_result').html(data); } , error: function(){ alert('failure'); } }); }); 

The second one takes the id of the link and sends it there (Page navigation)

  $(document).on('click','.pag',function(){ var url = "ajax/objects.php"; var id = $(this).attr('id'); var dataString = 'id='+ id ; var parent = $(this); $.ajax({ type: "POST", url: url, data: dataString, success: function(data) { $('.ajax_result').html(data); } , error: function(){ alert('failure'); } }); }); 

How to combine these 2 scripts in 1?
That the script sent the data from forms and id links

    1 answer 1

    The serialize function converts a form to a string of the form: key1=value1&key2=value2

    Therefore, all you need is to add two lines: dataString = $("#search_form, #order-form").serialize() + '&' + 'id='+ id