Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Processing message while the FB login window is opened.

Posted on 2014-01-19
8
Medium Priority
?
437 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
Amazon Web Services EC2 Cheat Sheet

AWS EC2 is a core part of AWS’s cloud platform, allowing users to spin up virtual machines for a variety of tasks; however, EC2’s offerings can be overwhelming. Learn the basics with our new AWS cheat sheet – this time on EC2!

 

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

Not sure which OpenStack Certification to get?

So you’ve realized you might want to get certified in OpenStack, but you’re not sure what the benefits might be or even which one you should take. You know there are several certification courses you can choose from, but how do you know which one is right for you?

Question has a verified solution.

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

PROBLEM: The other day I was working on adding an ajax request to a webpage that already had a dialog box on the page.  The dialog box was using relative positioning to be positioned next to a form field I had on the page.  Everything was working…
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)
Suggested Courses

688 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