The syntax for post()'s second parameter (data) should be serialized or key/data JSON pairs.
jQuery.post(".../gravatar-check.php", {userEmail: em...@email.com}, function(data) { // response callback } }); Here, your POST variable for the email will be "userEmail" ($_POST ['userEmail']). On Oct 6, 11:21 am, Milan Dinić <mdini...@gmail.com> wrote: > I'm beginner with jQuery and JavaScript in general and since I didn't > find solution in documentation or on web, I'm asking here. > > I'm writing some plugin for WordPress publishing tool which should > check if commenter has avatar on Gravatar.com. This part works for > unregistered users and you can see it in action > here:http://blog.milandinic.com/2009/10/04/google-news-soon-in-serbian-bul... > . It works when you enter e-mail address in comment form. > > Problem is that I want to check if registered users too have a > gravatar but since they don't fill e-mail address (its already stored > in database) I can't use script from above. I tried this modified > script but it doesn't work. > > <div id="gravatar_on_profile"></div> <script language="javascript"> > jQuery(document).ready(function() > { > > > jQuery.post("http://blog.milandinic.com/wp-content/plugins/ > gravatar-signup-encouragment/gravatar- > check.php","t...@example.com" ,function(data) > { > if(data) { > var emailValue = "t...@example.com" > > jQuery("#gravatar_on_profile").after("<br /><div > id='grav-sig-enc- > tip'>It seems that you don't have an avatar on Gravatar. Click <a > href='http://en.gravatar.com/site/signup/" + emailValue + "' > target='_blank'>here</a> to make one.</div>"); > } > }); > > }); > > </script> > > So its only important to pass e-mail address to gravatar-check.php and > if there is response to print message. I tried various events like > scroll, mouseover etc, but none worked. > > Thanks in advance.