By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,747 Members | 1,671 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,747 IT Pros & Developers. It's quick & easy.

Using AJAX with a PHP Front Controller

P: n/a
I have a framework that uses the front controller design pattern for a
single point of entry to the application and the autoload function for
includes. I am trying to incorporate AJAX into the framework, but the
javascript calls to php ignore my front controller code when
instantiating classes.

Can someone please provide me with some hints on how I can make this
work? Thank you.

Feb 7 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Aquaren wrote:
I have a framework that uses the front controller design pattern for a
single point of entry to the application and the autoload function for
includes. I am trying to incorporate AJAX into the framework, but the
javascript calls to php ignore my front controller code when
instantiating classes.

Can someone please provide me with some hints on how I can make this
work? Thank you.
Hi,

Hard to say without knowing what your frontcontroller does, BUT the
bottomline is this: When you let JavaScript instantiate a XMLHTTPRequest
(or whatever it is called in different browsers), you feed it the url,
check what your app returns.
Just make an alert in your JS with that url, and type that into a browser.
(Or when it is long, use prompt, so you can copy/paste it)

What does your application return?

PHP doesn't care if the XMLHTTPRequest makes a request, or somebody visits
your page 'normal'.
PHP just runs its script and produces the output.

So just debug your AJAX (and/or PHP) via direct calls to the url in your
browser.

PS: In case you use cookies / sessions: The XMLHTTPRequest DOES send the
cookie(s) the same way as a direct invocation via a browser would do. So
that should work alright.

Regards,
Erwin Moller
Feb 7 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.