Solved

Processing message while the FB login window is opened.

Posted on 2014-01-19
8
433 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

 

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

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

Introduction JSON is an acronym for JavaScript Object Notation.  It is a text-string data transport mechanism, capable of representing simple or complex data structures in a consistent and easy-to-read manner.  Similar in concept to XML, but more e…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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…
Suggested Courses

623 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