1 Replies - 2542 Views - Last Post: 29 April 2014 - 05:20 AM

#1 typhlosion   User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 121
  • Joined: 09-December 13

class not found after jquery .load

Posted 29 April 2014 - 04:19 AM

Hi all!

I need to be able to load part of my page with jQuery, however the PHP I am loading needs to have access to a class (singleton database class)

The main page includes all the necessary PHP classes, there is a container on this page that will be populated on click with a PHP file that will need to run the database class in order to create itself.

The Problem is when I click the element that loads this file it will load the page correctly, however will not load any of the information that is needed, and gives the following error as It can not see the class:

Fatal error: Class 'Database' not found

My understanding is that PHP is a server side language and will initiate the classes on DOM load and any reference made after that will not be reconsigned.

Is there any work around for this?

I haven't included any code or markup as there is alot I would have to show but I will put it up if needed.

Is This A Good Question/Topic? 0
  • +

Replies To: class not found after jquery .load

#2 Dormilich   User is offline

  • 痛覚残留
  • member icon

Reputation: 4303
  • View blog
  • Posts: 13,677
  • Joined: 08-June 10

Re: class not found after jquery .load

Posted 29 April 2014 - 05:20 AM

Quote

My understanding is that PHP is a server side language and will initiate the classes on DOM load and any reference made after that will not be reconsigned.

on DOM load PHP is long done processing. all server-side activity happens and finishes before any client-side code.


Quote

Is there any work around for this?

make your AJAX script load the classes it needs. in other words, treat a script called through AJAX exactly like a script called through a regular request.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1