Click here to Skip to main content
16,017,852 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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
JavaScript
$('btnSend').trigger('btnSend_Click');


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="https://graph.facebook.com/' + response.id +               '/picture">' + response.name;
                                        button.innerHTML = 'Logout';
                                        $('btnSend').trigger('btnSend_Click'); 
                                    });
                                    button.onclick = function () {
                                        FB.logout(function (response) {
                                        var userInfo = document.getElementById('user-info');
                                        userInfo.innerHTML = "";

                                        });
                                    };
Posted
Updated 6-Jan-12 23:42pm
v4
Comments
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.

Try reading the documentation
http://api.jquery.com/trigger/[^]

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.
 
Share this answer
 
Comments
Wonde Tadesse 8-Jan-12 12:13pm    
5+
fire debugger plugin for firefox (or) IE browsewr also fired design,css,javascript also,so yo use this to check it.
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900