jQuery Delegate fails to run ajax

msgz

New Member
Here is my jQuery using delegate and ajax:\[code\]$(".tweets").delegate("#fav #submit", "click", function(){ var favid = $("#fav input#favid").val(); var favsave = 'favid=' + favid; alert(favsave); $.ajax({ type: "POST", url: "fav.php", data: favsave, success: function() { $('#fav').fadeOut(100); } }); return false;}); \[/code\]The HTML:\[code\] <div class='tweets'> <ul class='entries'> <li> <form id='fav' method='post' class='favo' action=''> <input style='display: none;' type='text' name='fav' id='fav' value='".$row["tweetid"]."' /> <input type='submit' value='http://stackoverflow.com/questions/3733578/Add to Favorites' name='submit' id='submit' /> </form>" </li> </ul> </div>\[/code\]There is another set of Ajax on the page that is constantly adding to the .entries list, these records that get appended pickup the click function, so that when I click on them the Alerts are shown but the Ajax part of the function doesnt work. Any ideas? Would .live be better?
 
Back
Top