Tested, it can be bypassed with ajax(): $.ajax({ type: "GET", url: "profile.php", data: "do=addfriend&id=2" });
But is the get and "do" thing a bug? On Sep 27, 3:37 pm, indre1 <ind...@gmail.com> wrote: > After 3 DAYS, I finally figured it out: > $.get('profile.php', { do: 'addfriend', id: userId } > > The problem is, that the word "do" is reserved or something, thus you > can't use it in get, ajax and probably elsewhere. test.php? > do=something will never work from jQuery then, or how should I escape > it? > Is this a bug or just something everyone has to know? Strangely, on FF > it all worked. > > $.get('profile.php', { action: 'addfriend', id: userId } works > perfectly. > > On Sep 27, 1:27 pm, indre1 <ind...@gmail.com> wrote: > > > Well, the problem still seems to be in the get() function. For > > example, IE gives the following error: Object doesn't support this > > property or method > > With: > > (function($) { > > $.fn.followUser = function(userId) { > > this.fadeOut(250, function(){ > > $.get('profile.php', { do: "addfriend", id: userId }, > > function > > (data){ > > return this.html('<p>Follower > > added</p>').fadeIn(250); > > }); > > }); > > } > > > })(jQuery); > > > If I remove the whole $.get() part, the error is gone. Chrome will > > start fading out too. The code will then look like: > > (function($) { > > $.fn.followUser = function(userId) { > > this.fadeOut(250, function(){ > > > }); > > } > > > })(jQuery); > > > I even tried replace the get() with ajax(), but ran into the same > > problem. > > > Btw, thanks for the attr('rel') suggestion. This is something I was > > also looking for, but couldn't figure it out :) The html is now: > > <script type="text/Javascript"> > > $(function(){ > > $('div#followButton a').click(function(){ > > $('div#followButton a').followUser($(this).attr('rel')); > > });}); > > > </script> > > > ... > > > <div id="followButton"> > > <a rel="2">test1</a> > > </div> > > > On Sep 26, 6:48 pm, Matt Quackenbush <quackfu...@gmail.com> wrote: > > > > @ Mike - Thanks for making me take a closer look at the original code. I > > > get it now. My bad. > > > > /me crawls back into his cave to hibernate some more