You are here: Re: Using AJAX with a PHP Front Controller « PHP Programming Language « IT news, forums, messages
Re: Using AJAX with a PHP Front Controller

Posted by Erwin Moller on 02/07/07 14:26

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация