Click here to Skip to main content
12,072,640 members (63,343 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: ASP.NET Javascript
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
$('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 7-Jan-12 0:38am
Edited 7-Jan-12 0:42am
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.
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

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.
  Permalink  
Comments
Wonde Tadesse 8-Jan-12 12:13pm
   
5+
Rate this: bad
 
good
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.
  Permalink  

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.160208.1 | Last Updated 8 Jan 2012
Copyright © CodeProject, 1999-2016
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