help with ajax only working once
<p>Been trying to put this into a function to make live calls, but can't figure it out.</p>

<p>this works but only once:</p>

<pre><code>&lt;script&gt;
$(document).ready(function(){

    $(".addFavorite").click(function(){
        var row = $(this);
        $.ajax({
            type: "POST",
            url: "/app/Favs/jsoncreate?id=&lt;%= @place.ven_id %&gt;&amp;name=&lt;%= @place.name %&gt;",
            success: function(data){
                $(row).replaceWith('&lt;div id="' + data + '" class="vFav vBtn deleteFavorite"&gt;&lt;img src="/public/images/icons/favorite-.png" alt="Favorite -"&gt;&lt;/div&gt;');
                }
        });
    });
    $('.deleteFavorite').click(function(){
        var id     = $(this).attr('id');
        var row = $(this);
        $.ajax({
                    type: "POST",
                    url: "/app/Favs/jsondelete?id=" + id,
                    async: true,
                    data: id,
                    success: function(data){
                        if (data == "1"){
                            $(row).replaceWith('&lt;div class="vFav vBtn addFavorite"&gt;&lt;img src="/public/images/icons/favorite.png" alt="Favorite"&gt;&lt;/div&gt;');
                        }
                        if (data == "0"){
                            alert("Delete Failed!")
                        }

                    },
                    error: function(response){
                    alert('Favorite Delete FAILED!');
                    }
                });
    });
});
&lt;/script&gt;
</code></pre>
