Jump to content

Calling php objects outside of the web servers document root with ajax?


s0c0

Recommended Posts

I've always been taught to keep my php objects outside of the document root for security purposes, this way they are only accessible to the server.  I've been trying to learn ajax as of late and would like to keep doing it this way.  The examples I read have me creating a dumb php script (pageA.php for example) that echo's out data from a mysql table to a page and the ajax does a GET and prints this data to the current page (pageB.html for example)?

 

Is there a way to call my existing objects that are outside of apache's documen root and still return using the XMLHttpRequest?  Hopefully this has made sense.  I'd like to do this myself and not use an existing framework such as saja, I am open to json as my boss has requested i become familiar with it, but id like to get the basics down before learning a framework.

Link to comment
Share on other sites

whatever can be in a straight php page can be in a php page called by ajax.  an ajax called php page allows you no more access and no less access to your server resources than a straight php page called from the address field of your browser.

 

The only real difference between a php page called from the browser and a php page called from ajax is that the output of ajax called page is returned through the ajax pipe and then has to be injected into the existing page using js.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.