JavaScript Pass arguments to afterclose callback on click of button in fancybox

In the parent html page , when I click a link fancybox dialog opens up and I load a laravel php view page in that fancybox.

When I press 'login with twitter' button in fancybox dialog, then I want to close the fancybox and redirect to a route(login/twitter)

When I press 'login with facebook' button in fancybox dialog, then I want to close the fancybox and redirect to a route(login/facebook).

To know where to route, I need to know which button is click in the afterClose callback function.

//parent.php

$(".myDiag").fancybox({
        width       : 900,
        height      : 600,
        maxWidth    :"95%",
        padding     : 0,
        fitToView   : false,
        autoSize    : true,
        autoScale   : true,
        autoDimensions: true,
        closeClick  : false,
        openEffect  : 'none',
        closeEffect : 'none',
        afterClose : function(signupSource)
            {
                if(signupSource)
                {
                    window.location = "<?php echo route('login'); ?>" + "/" + signupSource;
                }   
            }
    });

//js in Fancybox.php


$('#loginWithTwitter').click(funciton(){
    parent.$.fancybox.close('twitter');  // 'twitter' is not getting sent to the afterClose callback function
});

How to pass the signupSource from Fancybox.php to parent.php?

Answer:1

In java, I have this URL as a string: window.location.href = "http://localhost:8080/bladdey/shop/c6c8262a-bfd0-4ea3-aa6e-d466a28f875/hired-3"; I want to create a javascript regular expression to ...

In java, I have this URL as a string: window.location.href = "http://localhost:8080/bladdey/shop/c6c8262a-bfd0-4ea3-aa6e-d466a28f875/hired-3"; I want to create a javascript regular expression to ...

  1. javascript string pull
  2. js retrieve string
  3. javascript pull query string
  4. javascript pull out string
  5. javascript string retrieve
  6. javascript pull number from string
  7. javascript pull date from string
  8. javascript pull number out of string

I'm running the following code to set a limit on characters in a textarea: (function($){ $.fn.extend({ limit: function(limit,element) { var interval, f; var self = $(this); ...

I'm running the following code to set a limit on characters in a textarea: (function($){ $.fn.extend({ limit: function(limit,element) { var interval, f; var self = $(this); ...

  1. count carriage return javascript
  2. count carriage return excel
  3. count carriage return c#
  4. count carriage return java
  5. count carriage return python
  6. excel count carriage returns in cell
  7. javascript count carriage returns in string
  8. vba count carriage returns in string
  9. c# count carriage returns in a string
  10. sql count carriage returns
  11. jquery count carriage return textarea
  12. count lines carriage return
  13. count number of carriage returns excel
  14. vb.net count carriage returns in string
  15. count number of carriage returns vba
  16. php count carriage return
  17. js count carriage returns

I know how to click a link using javascript, document.getElementById('yourLinkID').click(); But what if your ID is always changing or you are not sure what your ID is going to be? I have a html ...

I know how to click a link using javascript, document.getElementById('yourLinkID').click(); But what if your ID is always changing or you are not sure what your ID is going to be? I have a html ...

  1. click save html

I have two javascript objects that are used to replicate data objects. They are filled in via onclick events, and I want to clear them out after a save event. For example, var currentStrategy = { ...

I have two javascript objects that are used to replicate data objects. They are filled in via onclick events, and I want to clear them out after a save event. For example, var currentStrategy = { ...

  1. clear internal javascript