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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:10:07+00:00 2026-05-27T02:10:07+00:00

I manage a Drupal 7 based website for my College’s Student’s Association. Most of

  • 0

I manage a Drupal 7 based website for my College’s Student’s Association. Most of it is standard static pages. Each year we run a room ballot for people to choose their rooms and this process will need an application to display current room allocations (in real time) and wiki style information about what the different rooms are like.

I need to be able to serve up static pages of HTML, javascript and css; bypassing the theming module. I need the relative addressing in the html page which serves as the root of the application to work properly (e.g. “javascript/app.js” should pick up that file from within the module). I then need to serve up json data from php using all the drupal APIs for permissions and database access etc.

I have a fair bit of experience in HTML, Javascript etc. and some in PHP, but I’m fairly new to Drupal module development.

  • 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-27T02:10:07+00:00Added an answer on May 27, 2026 at 2:10 am

    You should create a custom module as you suggest, and separately put your HTML5 application in a sub-folder of the module. When it’s accessed it will use the same relative paths as you’d normally expect so javascript/app.js will work if the file exists in the path under your HTML5 app’s folder.

    For the JSON data your custom module will look something like this:

    function mymodule_menu() {
      $items['my/app/data'] = array(
        'page callback' => 'mymodule_ajax_callback',
        'access callback' => TRUE,
        'type' => MENU_CALLBACK
      );
    
      return $items;
    }
    
    function mymodule_ajax_callback() {
      $type = $_POST['type'];
    
      $nodes = db_query("SELECT nid, title FROM {node} WHERE type = :type", array(':type' => $type))->fetchAllKeyed();
    
      drupal_json_output($nodes);
    
      drupal_exit();
    }
    

    That code defines a menu path (using hook_menu()) at mp/app/data which uses mymodule_ajax_callback() as it’s page callback.

    mymodule_ajax_callback() simply grabs all nodes from the database that match the type parameter passed in the AJAX $_POST and outputs their id and title in a JSON string to the page (which will then be returned as your AJAX response when you request /my/app/path).

    Hope that helps

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

Sidebar

Related Questions

I have a website where drupal manage the contents, but another application handle the
I'm looking for a way to manage edit permissions on Drupal 6 nodes based
How do i manage to put images inside the body in drupal, I need
I am working on a Drupal setup and have run into a slight issue
hi i have installed the CIVICRM onmy drupal website. but i have no idea
I'm going to convert a custom-coded website to one of the most known CMS.
I manage a group of scheduled tasks that run daily. The scheduled tasks launch
I'd like to manage a timetable using Drupal 6, there are several pieces of
Is there a plugin/standard HTTP API for accessing user roles/permissions in a Drupal 6
I'm looking for a download manager module for Drupal. Ideally, it would give the

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.