how to post the clicked element attribute with ajax

how to post the clicked element attribute with ajax

Hello,

I'm trying to post variables dynamically with ajax.
The code I have come up to until now is:

  1. $("#formid input").click(function() {
  2.     var btnclick = $(this).attr("name");
  3.     $.ajax({
  4.       url: "mydomain.com",
  5.       type: "POST",
  6.       data: {id: "1", btnclick: "1"},
  7.       success: function(data) {
  8.         $(".comres").html(data);
  9.       }
  10.     });
  11.     
  12.     return false;
  13.   });


The problem is that it is not posting the name of the clicked button but it must be posting btnclick=1 no matter what button was clicked.
Any tips?
Thanks in advance.

Spyros