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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:09:19+00:00 2026-05-13T15:09:19+00:00

I’m posting simple version of php and Jquery code of the page that I

  • 0

I’m posting simple version of php and Jquery code of the page that I need to create.
As you can see, this example contains PHP break functions, and the name of this page is test.php.

The problem is, when I try to open the first part of this page (case 1) Jquery load function successfully is started and successfully load case 2 in the same DIV the second Jquery code for alert message. But if FireFox and Chrome that alert message it would not show up. Why?

Thx.

The code of the compleate page is:

<?php
include_once '../include/config.inc.php';
include_once '../include/options.inc.php';
include_once '../include/security.inc.php';
include_once '../include/functions.inc.php';
include_once '../templates/config.php';
?>
<script type="text/javascript" src="jquery/jquery-1.3.2.min.js"></script>
<script type="text/javascript"> 
$(document).ready(function(){
$("#one").live("click", function(){
$("#xuy").load("test.php?x=2");
});
});
</script>
<script type="text/javascript"> 
$(document).ready(function() {
$('#test').click(function() {
     alert("test for alert message");
   });
 });
</script>

<style>
#xuy{ width:770px; height:230px; border:1px solid #999; background-color:#33FF00;}
#one{ border:1px solid #F00; width:555px; background-color:#FFFF00;}
#two{ border:1px solid #000; width:355px; background-color:#CCCCCC;}
#three{ border:1px solid #ccc; width:255px; background-color: #00FFFF;}
</style>
<?
if (!isset($x)) $x = '';
switch ($x)
{
default:
case 1:
?>
<div id="xuy"><div id="one">DIV one</div></div>
<?
break;
case 2:
?>


<div id="two">DIV two</div><br>
<div id="test">click for Jquery alert</div>


<?
}
?>
  • 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-13T15:09:20+00:00Added an answer on May 13, 2026 at 3:09 pm

    I think the problem is not with the break, but the following:

    When you first open the page, the $(document).ready handler is fired. In this handler you try to bind to the event $(‘#test’).click, but #test does not exist yet!

    Then you load the second page by calling:

    $("#xuy").load("test.php?x=2");

    This starts an AJAX call and inserts the result into the DIV called “xuy”. You insert $(document).ready again into the HTML, but the handler is not called, because the document is already “ready”. So your event handler to $(‘#test’).click ist not attached!

    You would have to do this inside a tag in the loaded file, such as:

    <div id="two">DIV two</div><br>
    <div id="test">click for Jquery alert</div>
    <script>
       $('#test').click(function() {
         alert("test for alert message");
         });
       });
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm making a simple page using Google Maps API 3. My first. One marker
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Seemingly simple, but I cannot find anything relevant on the web. What is the
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I have a French site that I want to parse, but am running into

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.