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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T00:07:56+00:00 2026-06-09T00:07:56+00:00

In reference of my other question: Context-aware AJAX call in a modular site ,

  • 0

In reference of my other question: Context-aware AJAX call in a modular site , is it possible to set up an AJAX proxy in a convenient way?

I’d wish to make AJAX requests with dynamic url without tainting the JavaScript code with server-side PHP instructions, computing the right path for the ajax php file in a modular Apache/PHP/MySQL site, a rough CMS written by me.
In other words, the site has plugins and components with their own folder structures containing their CSS, JS, and PHP and I have functions to retrieve their folder dynamically. I’d wish that:

$("#mydiv").load(siteRoot + "/ajax.php?plugin=datagrid&
action=myaction&... other params...");

will instead call (with the URL computed server-side by PHP):

{siteRoot}/components/datagrid/ajax/myaction.php?... other params ...

(obviously with all the possible checks against injections, CSRF and other hacks).

  • 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-09T00:08:00+00:00Added an answer on June 9, 2026 at 12:08 am

    /ajax/get.php file should look something like this:

    $plugin = $_GET['plugin'];
    $action = $_GET['action'];
    $get = array();
    foreach ($_GET as $k=>$v) {
        if($k!='plugin' && $k!='action') {
            $get[] = "{$k}={$v}";
        }
    }
    $url = 'siteRoot/components/'.$plugin.'/ajax/'.$action.'.php?'.implode('&', $get);
    
    header("Location: {$url}");
    

    Of course, you need to add some security checks to above code

    EDIT: The downside is that it won’t work for sending POST requests

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

Sidebar

Related Questions

Is it possible to access the view (or any other reference) of the recent
As title, I searched official google maps api reference and other site, I can't
Should a business object contain a reference to other objects (as in the id
Because shells other than ksh do not support pass-by-reference, how can multiple arrays be
What languages other than C and C++ have explicit reference and pointer type qualifiers?
I understand the reference variable concept. It's an alias to the other variable. int
Can I do this without reference to the object in the constructor? In other
Can I get the value of MotionEvent.getRawX()/getRawY() of other pointers ? MotionEvent.getRawX() api reference
I am using code from other question and i am getting the error as
Update: Please read this question in the context of design principles, elegance, expression of

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.