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

  • Home
  • SEARCH
  • 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 7546889
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T09:18:55+00:00 2026-05-30T09:18:55+00:00

I am in the process of developing a module which needs to make an

  • 0

I am in the process of developing a module which needs to make an ajax call to a menu path defined by the same module.

Below is the hook_menu function:

function staff_filter_menu(){
        return $items['staff/filtering/results'] = array(
            'page callback' => 'staff_filter_function',
            'type' => MENU_CALLBACK,
        );
    }

    function staff_filter_function(){
        drupal_json( array('status' => 0, 'data' => "staff_filter_function RESPONDING!"));
    }

And the js code:

(function($){

$(document).ready(
function(){
    $results = $.get('http://localhost/test1.localhost/?q=staff/filtering/results');

    //$results = $.get('http://localhost/test1.localhost/?q=admin/config/people');
    //$results = $.get('http://localhost/test1.localhost/admin/config/people');
});

})(jQuery);

The first line (the call to my defined menu) fails and returns a 404 error in firebug.

So, I tried an existing random menu which are the 2 following menus. But I made one work with clean URLs and the other without. The existing menu set with a clean URLs also failed but the same menu which isn’t a clean URL worked fine.

Because my localhost installation is not happy to work with clean URLs regardless of what I try, I need a technique to make my module flexible regardless of if the site is working with or without clean URLs (particularly if I end up releasing it).

  • 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-05-30T09:18:56+00:00Added an answer on May 30, 2026 at 9:18 am

    You can use the Drupal function URL. This will adjust accordingly if clean URL’s are on or off.

    For example:

    <a href="<?=url('node/' . $node->nid, array('alias' => FALSE))?>">
    

    Will return either:

    ?q=NODE_ALIAS if clean URL’s is off

    OR

    NODE_ALIAS if they are turned on.

    This has saved me loads of hassle as I have a similar issue with my localhost. For more info on the URL function – http://api.drupal.org/api/drupal/includes%21common.inc/function/url/7

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

Sidebar

Related Questions

I'm currently developing an application which needs a lot of system and process information,
I am developing a module which has a jQuery script with some AJAX code.
We're in process of developing a desktop application which needs to record user's screen
I am in the process of developing an SSIS job on my workstation which
We're currently in the process of developing a web-based application which will require the
We're in the process of developing a new desktop application for a customer which
I am in the process of developing a application which displays dialogs depending on
I am in the process of developing an application which uses a legacy USB
I am in the process of developing a simple JFrame based GUI to which
We are in the process of developing a .NET based IIS hosted web application

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.