You dont need to add the onclick event on the link itself.

<a id="addAtty" href="#" class="addmore">Add More Items</a>

Just putting your link like this may fix the issue.
By the way you dont need to use e.stop() and e.preventDefault(), e.stop(),
calls e.preventDefault() and e.stopPropagation().
I would recomend you t use just e.preventDefault() as your event will not
bubble up if you call e.stop(), it will work fine.

Do it solves the issue?

Cya



--
Fábio Miranda Costa
Solucione Sistemas
Engenheiro de interfaces


On Fri, Mar 19, 2010 at 2:43 PM, praveen <[email protected]> wrote:

> Hi, I am submiting a form on click of hyperlink using ajax call. the
> issue is, first time it works fine. Second time i click the link the
> event is firing twice and submiting twice. 3rd time it submits 3
> times..and so on..I am not getting why it is happening. Here is the
> hyperlink and its code.. Let me know where i am doing wrong.
>
>        function processFormAjaxCall(remoteUrl, targetDiv, formId, method) {
>                alert("form submit" + remoteUrl + ":" + targetDiv);
>                var request = new Request.HTML({
>                    url: remoteUrl,
>                    update: targetDiv,
>                    method: method
>                });
>
>                $('addAtty').addEvent('click', function(event){
>                        if (event) {
>                                event.stop();
>                                event.preventDefault();
>                        }
>                    request.post($(formId)); //This code is executing more
> than once
> time as i keep clicking my hyperlink.
>                });
>        }
>
>
> Hyperlink in my jsp look like this(like a normal link, but just
> incase)
>        <a id="addAtty" href="#" class="addmore"
> onclick="processFormAjaxCall('addMoreItems.action',
> 'resultList','frmId','POST' )">Add More Items</a>&nbsp;&nbsp;
>
>
> I click the hyperlink id: "addAtty" to trigger the ajaxcall. Please
> let me if some help me to figure out whats happening, is it a ajax
> issue or something else.
>
> To unsubscribe from this group, send email to mootools-users+
> unsubscribegooglegroups.com or reply to this email with the words "REMOVE
> ME" as the subject.
>

To unsubscribe from this group, send email to 
mootools-users+unsubscribegooglegroups.com or reply to this email with the 
words "REMOVE ME" as the subject.

Reply via email to