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 8009879
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T18:34:35+00:00 2026-06-04T18:34:35+00:00

Where am I going wrong with my programming logic here? I have 2 php

  • 0

Where am I going wrong with my programming logic here?

I have 2 php files. File 1 includes File 2. File 1 calls a php function from File 2. Inside the php function there is a bunch of html. The html works perfectly. At the end of the function I have this javascript….

<script type="text/javascript">
alert('hello');
</script>

This javascript isn’t alerting “hello”.
What am I doing wrong?

Thank you in advance.

EDIT: New question because I skrewed the last one up.

In theory would the code below run properly? (yes/no)

<?php function AlertHelp(){ 
    ?><script>
        alert('help');
    </script><?
AlertHelp();
?>
  • 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-04T18:34:37+00:00Added an answer on June 4, 2026 at 6:34 pm

    Long shot on a wild guess here with the limited information you gave.

    My assumption is that you are not “including” the file via PHP’s include, require, include_once or require_once functions, but are in fact using AJAX to load in the page’s content.

    If this is the case, then I shall also assume you’re using innerHTML to put the content on the page.

    Suddenly the solution is obvious: <script> tags added by innerHTML are not parsed and run. You could probably do something like this:

    // assume `result` is the variable containing the AJAX response and `elem` the element it goes in
    elem.innerHTML = result; // this doesn't change
    result.match(/<script[^>]*>([\s\S]*?)<\/script>/i,function(m) {eval(m[1]);});
    

    Please note however that eval should be avoided if possible. Consider redesigning your layout to use callbacks instead.

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

Sidebar

Related Questions

I don't know either my implementation have bugs or StringBuilder is going wrong. From
Can anyone spot where I might be going wrong with the following code? <?php
I need to know what is going wrong here, when I try to run
I can't figure out where I'm going wrong here. Trying to validate an email
I can't figure out where I'm going wrong here. Hopefully one of you can
You can check page here: http://jsfiddle.net/7JhjN/ Basicly, there is a hell of duplication going
I am new to Iphone programming. Please correct me where am I going wrong.
New to programming in general, so I'm probably going about this the wrong way.
I have started learning Objective C with no prior programming experience from the 'Become
If anyone can shed light on what's going wrong here, perhaps a misordering of

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.