You can't have 2 elements with the same id on the same page.  Instead
do <a class="button" and change your selector to use $("a.button").  I
would also recommend using <a href=""


I'm kind of doing the same thing (i have a thread about it), is it
safe to put event parameters in arbitrary attribute names?  i.e.: <td
class="trigger" record="${record.ID}" paramX="${paramX}" paramY="$
{paramY}">

isn't that invalid html and rejected by some browsers?  or is that
normal and just fine to do?


On Jul 2, 12:44 pm, Glazz <brunofgas...@live.com.pt> wrote:
> Hi there,
>
> I have a hyperlink ( <a> ) after i click on that hyperlink, the script
> sends some data to a .php page;
>
> That works fine, but for just one hyperlink , i want to be able to
> have 2 or more hyperlinks in the same page using the same script.
>
> Here goes the script:
>         $("#button").click(function(){
>                 var element = this;
>                 var productId = $(element).attr('product');
>                 //$(element).attr("href", "javascript: void(0);");
>                 $.ajax({
>                    type: "GET",
>                    url: "index.php",
>                    data: "product=" + productId
>                  });
>         });
>
> HTML:
> <a id="button" rel="nofollow" product="10" href="#test">Product 10</a>
> <a id="button" rel="nofollow" product="20" href="#test">Product 20</a>

Reply via email to