Difference between #4 and #5 of
How to avoid multiple Ajax Request

Revision #5 has been created by nickcv on Apr 21, 2011, 12:33:35 PM with the memo:

« previous (#4)


Title unchanged

How to avoid multiple Ajax Request

Category unchanged


Yii version unchanged

Tags unchanged

ajax request, ajax link, ajax request multiply

Content changed

The ajax request are triggered based on the link ID. Every time the div is reloaded through ajax a new delegate/event will be loaded pointing at the same ID of the one before him. So when you actually click on the link both delegates will do their job, because both match the clicked link.

##What can I do to avoid this problem?

###Easy solution
The answer is extremely simple: **assign to your ajax link a random ID**.

You can achieve this result doing something like this:
17 0
Viewed: 56 742 times
Version: 1.1
Category: How-tos
Written by: nickcv
Last updated by: nickcv
Created on: Apr 21, 2011
Last updated: 7 years ago
Update Article


View all history