Solved

Processing message while the FB login window is opened.

Posted on 2014-01-19
8
416 Views
Last Modified: 2014-02-26
Hi,

I need to show the processing message while the fb login window is opened?
Code is given below

<script>
	window.fbAsyncInit = function() {
		FB.init({
			appId : 'XXXXXXXXXXXX', // App ID
			channelUrl : 'yyyyyyyyyyyyyy', // Channel File
			status : true, // check login status
			cookie : true, // enable cookies to allow the server to access the session
			xfbml : true
		// parse XFBML
		});

		FB.Event.subscribe('auth.authResponseChange', function(response) {
			if (response.status === 'connected') {
				getFBInfo();
			} else if (response.status === 'not_authorized') {

			} else {
			}
		});
		FB.login(function(response) {
			  if (response.authResponse) {
			     console.log('Welcome!  Fetching your information.... ');
			 } else {
			 console.log('User cancelled login or did not fully authorize.');
			} 
		}, {
			scope : 'email'
		});
	};

	// Load the SDK asynchronously

	 (function(d){
     var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
     js = d.createElement('script'); js.id = id; js.async = true;
[u]    [b] js.src = "//connect.facebook.net/es_LA/all.js";[/b][/u]
     d.getElementsByTagName('head')[0].appendChild(js);
   }(document));
	
</script>

Open in new window

0
Comment
Question by:Rocking
  • 3
  • 3
8 Comments
 
LVL 39

Expert Comment

by:gdemaria
ID: 39802955
If you'd like to display a message saying "processing" while you have an action going on, here is one way..

Create a hidden div, format as you'd like with the processing message.   When you run the script, the first line of code would be to make that div visible, then the user will see processing while the script runs.

If the page refreshes at the end of the processing, then no need to hide the div.  If it does not, then simply hide the div at the end of your code block.
0
 

Accepted Solution

by:
Rocking earned 0 total points
ID: 39803657
But the problem is how to identify the pop up window (fb login) is opened and now i should hide the div?

I am unable to find the event on which i can hide the div?
Please suggest...
0
 
LVL 39

Expert Comment

by:gdemaria
ID: 39803853
The div would look like this..   the ID tag would be the way you identify it in your code

<div id="procDiv" style="padding:8px;background-color:#cee7ff;text-align:center;">
  Processing...
</div>

Open in new window


Then you show it using this javascript...

document.getElementById('procDiv').display='block';

Open in new window

0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

Author Comment

by:Rocking
ID: 39805397
@gdemaria

I understand the above code but my problem is different:
i have shown the div -> OK

now the poopup window opens (fb login window),need to stop processing message or hide the div once the window is opened -> OK


Now on which event should i hide the processing image since the login window is of facebook?
0
 
LVL 39

Expert Comment

by:gdemaria
ID: 39840882
a little trial and error ...

            FB.login(function(response) {
                    if (response.authResponse) {
                       console.log('Welcome!  Fetching your information.... ');
                             ----- Perhaps in here -----------
                   } else {
                   console.log('User cancelled login or did not fully authorize.');
                  }
            }, {
                  scope : 'email'
            });
0
 

Author Closing Comment

by:Rocking
ID: 39888260
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are a couple ways to attach a JavaScript function to dynamically created elements. You can make a new script for each element as it’s created or you can use delegation. Delegation allows a single script that is added at page creation to mat…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now