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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T20:37:20+00:00 2026-06-16T20:37:20+00:00

I have an ajax call to a php page in which I pass an

  • 0

I have an ajax call to a php page in which I pass an ID using GET.

<script>
$("#oid").change(function(){
    var oid = $(this).val();
    alert(oid);
    $.ajax({
        type: "GET", 
        url: "tabela_reservas.php",
        data: "oid="+oid,
        success: function(html) {
            $("#tabela_reservas").html(html);
        }
    });
});
</script>

It works, except that PHP gives me an error:

Fatal error: Class ‘Reserva’ not found in C:\xampp\htdocs\kwagenda\tabela_reservas.php on line 20

If I include my class files in the "tabela_reservas.php" it works. But these Class files are already loaded/included in my "index.php" from where I’m calling this ajax page.

My question is: do I need to include my php Class file on "tabela_reservas.php" again or there is another way of doing it?

I ask this because, to me, it doesn’t seem to be a very elegant solution, and it look’s like an overhead, since I’ll be loading twice the same thing on my page.

Is this the right thing to do or there is another way of doing this?

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-16T20:37:21+00:00Added an answer on June 16, 2026 at 8:37 pm

    When you make an ajax request to the server, this is a completely new request, just like navigating to another page.

    So yes, you need to include everything again.

    You should look into autoloading of classes for a more elegant solution to include classes.

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

Sidebar

Related Questions

I have php page that has jquery ajax call. the begging of this page
I'm using an ajax call to call a php script which waits 40 seconds
I have index.php page which makes a ajax call to thread.php by sending the
I have a ajax function in index.php which calls on the page thread.php which
I have a php script that gets called via an ajax call. Values are
i have an ajax for submit script on my html page, which loads a
I have a php page used for an Ajax call. It produces output in
I have an ajax call which returns me following response: <div class=content> <script language=JavaScript>
I have an ajax call that fires multiple times but is called once. function
I have an HTML document, which loads content from a PHP file using an

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.