Click here to Skip to main content
13,044,935 members (40,819 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I want to fire a button click and get data from database just after facebook login, which returns Email ID., after facebook login with help of javascript. I am using

in below script, but it does'nt work?

<pre lang="Javascript">function updateButton(response) {
                                var button = document.getElementById('fb-auth');
                                var email = document.getElementById('lbemail');
                                var btn = document.getElementById('btnSend');
                                if (response.authResponse) {
                                    //user is already logged in and connected
                                    var userInfo = document.getElementById('user-info');
                                    FB.api('/me', function (response) {
                                   userInfo.innerHTML = '<img src="' + +               '/picture">' +;
                                        button.innerHTML = 'Logout';
                                    button.onclick = function () {
                                        FB.logout(function (response) {
                                        var userInfo = document.getElementById('user-info');
                                        userInfo.innerHTML = "";
Posted 6-Jan-12 23:38pm
Updated 6-Jan-12 23:42pm
Kethu Sasikanth 7-Jan-12 17:40pm
$('btnSend').. selector has a problem. It should have been $('.btnSend') if btnSend is class OR $('#btnSend') if btnSend is ctrl id.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Try reading the documentation[^]

1) The selector is incorrect. It should be $('.btnSend') or $('#btnSend') for selecting a class or element identifier, or some form of this.

2) The trigger function should be trigger('click') if you want to trigger a button click event.
Wonde Tadesse 8-Jan-12 12:13pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

fire debugger plugin for firefox (or) IE browsewr also fired design,css,javascript also,so yo use this to check it.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170713.1 | Last Updated 8 Jan 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100