Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8941609
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:20:45+00:00 2026-06-15T11:20:45+00:00

EDIT: I recently learned that this problem is actually two separate issues: 1) Using

  • 0

EDIT: I recently learned that this problem is actually two separate issues: 1) Using a script to close parent elements at the necessary junctures, and 2) Ensuring that the necessary functions were all called and completed in the correct sequence. I figured out two methods for closing the parent elements which I’ve included below. The 2nd issue is addressed here: Calling jQuery function in php (or modifying javascript so php runs the remaining code)


Original Question

I have 2 functions which I need to call once a form is validated and submitted, however I’ve been unsuccessful at inserting these functions into my script without preventing another function from being completed (either in the javascript or the php).

How can I integrate these functions to close parent items (an iframe and a notification to new users) into the script and/or call them from php after the form is validated and submitted?

New functions:

parent.close_field('notice');
parent.$.fancybox.close();

Existing Javascript

var $custInfo = $("#customer_info");
  $(document).ready(function () {
    var validator = $custInfo.validate({
        rules: {..  },
        messages: {..},
        errorLabelContainer: "#messageBox",
        submitHandler: function () {  
            $custInfo.ajaxSubmit({               
            });
        }
    });                 
    $custInfo.find("input[name=gender]").change(function () {
        if ($(this).val() == "male") {
            $custInfo.submit();
        }
    });
});

I’m using Fancybox2. I’ve also tried other methods which require adding attributes to the form tag, however those circumvent the script entirely.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T11:20:47+00:00Added an answer on June 15, 2026 at 11:20 am

    I recently learned that this problem was actually 2 separate issues: 1) Using a script to close parent elements at the necessary junctures, and 2) Ensuring that the necessary functions were all called and completed in the correct sequence.

    I figured out two methods for closing the parent elements which I’ve included below. The 2nd issue is addressed here:
    Calling jQuery function in php (or modifying javascript so php runs the remaining code)

    Methods I used for closing the parent elements

    I figured out two ways to close the parent elements. I used Method 1 to close it when the form was submitted and Method 2 for those circumstances where I needed to close items onclick (i.e. if the user navigates to specific pages)

    Method 1

    In my particular example I needed to close ‘notice’ for everyone, but only close the iframe for new users who were male, so I added this to the function:

    submitHandler: function () {
                $custInfo.ajaxSubmit({
                success: function () {
    if ($('input[name=gender][value=female]').is(':checked')){                                                      
            parent.close_field('notice');
            window.location.href="page2.html";                                   
            }                             
            else if ($('input[name=gender][value=male]').is(':checked')) {
            parent.close_field('notice');
            parent.$.fancybox.close();
            alert("This service is not yet available for men, but we'll be sure to send an invitation as soon as it is");                             
            }
           }
         });
    

    Method 2

    JS

    function close_parent_items() {
         parent.close_field('notice');
         parent.$.fancybox.close();
    }
    

    HTML

    onclick="close_parent_items();"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

EDIT 9-3-10: I found this blog entry recently that was very enlightening. http://optimizermagic.blogspot.com/2007/12/outerjoins-in-oracle.html There
UPDATE: I recently learned from this question that in the entire discussion below, I
EDIT: Using simpler code. I have a blackberry app that until recently (I upgraded
EDIT: iam using ajax to load text in my content that is why onload
EDIT : It turned out that this can only be done through an external
I recently asked this question: Best choice? Edit bytecode (asm) or edit java file
Edit: I recently learned about a project called CommonMark, which correctly identifies and deals
Today Recently on Stackoverflow i learned that: reintroduce is used to hide ancestor constructors
Introduction Hello folks, I recently learned to program in C! (This was a huge
I recently learned about strides in the answer to this post , and was

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.