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

  • SEARCH
  • Home
  • 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 6047891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:24:08+00:00 2026-05-23T07:24:08+00:00

I have 3 files (file1.php, file2.php and file3.php). Their contents are given below. When

  • 0

I have 3 files (file1.php, file2.php and file3.php). Their contents are given below. When I load file1.php it shows two times the message of “Hello” in an alert box. But when I include file3.php before or after dialogbox (which is in file2.php) then it shows that message only one times (which is what I want).

Does anybody know where is the problem please?

Thanks.

The content of file1.php

<?php 
     some operations
     require_once("file2.php");
?>

The content of file2.php

<script type="text/javascript">
   $(document).ready(function() {
       var dialogOpts={        
         autoOpen: true,
         modal: false,
         height: "auto",
         resizable: false,
         closeOnEscape: true,
         width: 700,
         position: ["center",30]
       }
       $('#learning_activity_wizard_dialog').dialog(dialogOpts);
   });
</script>
<?php 
     some operations         
?>
<div id="learning_activity_wizard_dialog" title="Learning Activity Wizard" class="dialogbox">
    some content
    <?php require_once("file3.php"); ?>
</div> 

The content of file3.php

<script type="text/javascript">
  $(function () {
      alert('Hello');
  });
</script>
sometext
  • 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-05-23T07:24:09+00:00Added an answer on May 23, 2026 at 7:24 am

    When jQuery creates the dialog box, it copies everything in the learning_activity_wisard_dialog div to a new DOM node, including the script tag.

    So, the tag runs once when the page loads, then again when the dialog is rendered. Move your script out of that div, or just use some bool to track whether it’s already run or not.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a project (Web/PHP) where we would like users to access their files,
I have two PHP files that I need to link. How can I link
I'm writing multilingual website. I have several files on server like: /index.php /files.php /funny.php
I have several PHP files include()ing other files from several other directories. In one
I have some php files in a server which generate xml code in them.
I have various PHP files which data is Posted to (like the password when
I have 2 files namely: uploading.php emaillinks.php both include a file inc.php which has
I have some files: core.php : require_once 'logger.php'; require_once 'smth_else.php'; $Logger = new Logger();
I have a index.php file that will include several external files: content/templates/id1/template.php content/templates/id2/template.php content/templates/id3/template.php
I have a set of .php files in a folder, I want to add

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.