Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Watch your semicolons, make sure you end each command with one, will save you a headache later.</p> <p>As for events bound by <code>live()</code>, they have to be unbound by calling <code>die()</code>. It has the same parameters as <code>unbind()</code>. Have a look at the <a href="http://api.jquery.com/die/">documentation</a>.</p> <pre><code>function ajaxHandler(){ var addassociateID = $(this).attr("id"); var $this = $(this); $this.die('click'); $.ajax({ type: 'POST', url: '/data/watchlist_save.asp', data: {m : 'share_watchlist_add', watchListID : &lt;%=WatchListID%&gt;, a : addassociateID}, async: true, success: function(data) { $(".associate_users").load("/data/sub_watch_members.asp?watchListID=&lt;%=WatchListID%&gt;",{cache:false},function(){ $(".search_note").html(data); $this.bind('click',handler); }); }, error: function(data){ $(".search_note").html(data); $this.live('click', ajaxHandler); } }); } $("input[name=add_associate]").live("click", ajaxHandler); </code></pre> <p><strong>Edit:</strong> Forgot to add some important points. You have to unbind your live event right in the click handler and rebind it on error, just like <strong>@stefan</strong> suggested.</p> <p>Also make sure you save the <code>this</code> object in a variable, as it's not pointing to your DOM element within the ajax callback function. Alternatively you can use the <code>context</code> property on your ajax request, check the <a href="http://api.jquery.com/jQuery.ajax/">documentation</a>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload