jquery: bind onclick
问题 $(document).ready(function() { $('a#fav').bind('click', addFav(<?php echo $showUP["uID"]; ?>)); }); was before $(document).ready(function() { $('a#fav').bind('click', addFav); }); I added (<?php echo $showUP["uID"]; ?>) because i want the user profile´s id to work with in the addFav ajax call. So i have this at the bottom of my page and now even if i havnt clicked on the a#fav it runs it? But it doesnt run itself when i dont have the (id) Heres addFav in case: function addFav(id){ $.ajax({