tags:

views:

43

answers:

1

Hi All,

Im using some jQuery sortables and I basically have two event handlers set up in the sortable init (receive and stop) The problem is, If the receive event fires then I don't want the stop event to fire. In other words, it's sending two ajax requests to my server when I only need one sent.

Is there some way to check if the receive event has already fired?

Thanks!

+1  A: 

Sample code would help some, but you can use things like $(this).data({fired: false}); to store an attribute on the Sortable. Then, in your Receive and Stop methods do something like var props = $(this).data(); if (!props.fired) { // your execution code } as a way of detecting it. Inside of the execution block you'd include a line like $(this).data({fired: true}); to record that it's been sent.

g.d.d.c
Slightly more compact: `if ($(this).data('fired')) ...` You also don't need to initialize it that way.
Tgr