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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T08:50:53+00:00 2026-06-06T08:50:53+00:00

I have variable in the parent document eg. $var = ‘blah’; Then a div

  • 0

I have variable in the parent document eg.

$var = 'blah';

Then a div is populated with a Jquery AJAX call and that file has the line.

<?php echo $var; ?>

At the moment I am getting

Notice: Undefined variable:

How can I resolve this.

  • 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-06T08:50:56+00:00Added an answer on June 6, 2026 at 8:50 am

    Is your $var in the same php as the jQuery? You need to echo the $var from the php file that you initialized it in.

    For Example:

    A.php

    <!DOCTYPE html>
    <html>
        <head>
            <script type="text/javascript" src="jquery.js"></script>
            <script type="text/javascript">
                $(document).ready(function() {
                    $.ajax({
                        url : "B.php",
                        success : function(out) {
                            $('#out').html(out);
                        }
                    });
                });
            </script>
        </head>
        <body>
            <div id="out">
            </div>
        </body>
    </html>
    

    B.php

    <?php
      $var = "foo";
      echo $var;
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a function that needs to access a variable in its parent environment
I have a website that consists of one parent page. Using the lightbox-style jQuery
I have variable which I populate from JSON formated data. Something like: var time=my_data[data.results[i].id].time;
I'm studying javascript these days and I have question. I have variable that contain
I have written a plugin that looks like this so far: (function($) { var
I have a parent document with an embedded iframe. Inside the iframe I have
I have two Divs inside a parent Div ( overflow: auto) the two Divs
I have a javascript function that goes something like this: function doSomething(me) { var
I have the following code: foreach (var parent in parents) { var children =
I have the following code: $(document).ready(function(){ $(.uiCloseButton).click(function(e) { e.preventDefault(); var element = $(this).parents('.uiOverlay'); alert(element);

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.