Jump to content

Recommended Posts

Hello, I tried searching on the net but couldn't find anything that was similar to what I am doing.  I want to use Google +1 so that when the user clicks on it, their ID is sent to a PHP file where I can add code to insert into the DB.  Here is the Google code:

 

<g:plusone size="medium" callback="earn" href="http://www.site.com/"></g:plusone>

 

I noticed the callback="" in the g tag acts like an onclick function as I tested it and made it alert something in javascript when I created a javascript function. 

 

Could you please provide me with the JQuery needed to pass an ID from that plusone tag to a PHP file please?  Thank you.

A callback is a function or piece of code that is called after a specific event or action. In this case it's called after the +1 button is clicked, but it's not triggered by the click event. The Google API will return to call that code after it's done what it does.

 

As for writing it for you, I'm afraid that simply won't happen. We're here to help you if you get stuck trying to do it yourself, not complete your work at your request. We can guide you though..

 

Creating an AJAX request is extremely easy with jQuery (look into the jQuery.ajax API). As a first step, get that working with a static value. Then concentrate on retrieving the "ID" - although I have no idea where this ID comes from. Is the callback function handed some kind of response data containing it? Never used the Google +1 API before.

I have spent the past two days researching and trying to figure it out but I cannot.  I figured this would be an easy two line code for someone who understands JQuery.  Sorry but not all of us are rich or living at home with our parents.  I learned about 6 programming languages and suddenly JQuery came along and I have to become a doctor in it as well just for it to be replaced again in a couple of years?  My brain cannot hold all of that info and my bills are not being forgiving.

Did you look at the jQuery.ajax API? It's pretty straight-forward. You can practically copy and paste the code provided, and only have to change the path to your PHP script to get it working.

 

By the way I'm not rich and I don't live with my parents. I don't get what you're getting at there? Many people can pick up jQuery because it's so simple and there's plenty of documentation/tutorials available. If you're not willing to learn it yourself, either pay someone to do it or don't expect to use it.

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.