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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T15:03:42+00:00 2026-06-09T15:03:42+00:00

My index.php switch ($action){ case calendar: echo <script language=\javascript\>\n; echo document.write(‘Hello World!’); echo </script>;

  • 0

My index.php

    switch ($action){

         case "calendar":

         echo "<script language=\"javascript\">\n";

         echo "document.write('Hello World!')";

         echo "</script>";

         include($_STR_TEMPLATEPATH."/calendar_view.php");

         break;

    }

my calendar_view.php:

I have an ajax function which should call the action calendar from the index and display the result on calendar_view.php in calendar div

<script>
    function calendarList()
    {
    var xmlHttp;
    try
      {
      // Firefox, Opera 8.0+, Safari
      xmlHttp=new XMLHttpRequest();
      }
    catch (e)
      {
      // Internet Explorer
      try
        {
        xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
        }
      catch (e)
        {
        try
          {
          xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
          }
        catch (e)
          {
          alert("Your browser does not support AJAX!");
          return false;
          }
        }
      }
    xmlHttp.onreadystatechange=function()
    {
    if (xmlHttp.readyState==4 && xmlHttp.status==200)
      {
      document.getElementById("calendar").innerHTML=xmlHttp.responseText;
      }
    }

      xmlHttp.open("GET","?action=calendar",true);

      xmlHttp.send(null);

    }
  </scritp>

The calendar div:

<div id="calendar"></div>

When I call the calendarList function it did call the case, but did not display the result in calendar div.

Any help. Thanks

  • 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-09T15:03:43+00:00Added an answer on June 9, 2026 at 3:03 pm

    There is not much to display there. If everything works like you described, the response is appended to the DOM, but the JavaScript-alert will never be executed.

    Try alert(xmlHttp.responseText); to be absolutely sure that your response is correct. If it is, you can go from there.

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

Sidebar

Related Questions

My code looks like: index.php : <html>.... <title>My page</title> .... <?php switch ($_GET['id']){ case
index.php: <form action=update_db.php method=post> <?php require_once 'modules/' . $currentModule . '.php'; ?> </form> modules/
We have url: http://site.com/index.php?action=show $_GET['action'] is used in templates to check value of ?action=
It give me this error : Undefined index: action in LINE : $act=$_POST['action']; <?php
How can I change the action of this form? It currently posts to index.php
I have the following .htaccess rule: RewriteEngine on RewriteRule ^(.*) http://www.server2.com/index.php?action=$1 I need to
I have a ajax.php file that contains the following sample code: switch($_REQUEST['request_name']) { case
I have two files : index.php condition.php condition.php hold some switch statements. I wrote
index.php <?php require_once('fr.php'); header('Location:'.abspath().directory()); ?> fr.php <?php require_once('functions.php'); ?> functions.php function abspath() { return
I have a index.php page that is the main page. All pages are included

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.