var data = { $(this).attr('name') : $(this).val() } $.post('link.php', data, function(){}) 

I want to give an unknown number of parameters (data) to $ .post. How to implement this? Please throw some example of how to implement this. Thank you.

    1 answer 1

    Read about the functions .serialize () and .serializeArray () It is possible that this will solve the breakdown. If not, then you need to drive all the values ​​into the array yourself, which you need to send to the handler.

    • .serializeArray () this function works as it should. Thank you - anton