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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:18:19+00:00 2026-06-15T15:18:19+00:00

I have a jquery code below which is displayed in the editsessionadmin.php page. Now

  • 0

I have a jquery code below which is displayed in the editsessionadmin.php page. Now what is suppose to happen is that when this page is opened, in will perform the jquery/ajax function so that it navigates to the module.php page in order to be able to select a list of modules from a query, display each module as an option and display those options in the module drop down menu in the editsessionadmin.php page.

The problem I have is that it is not doing this. The jquery/ajax is not doing anything as that the Module drop down menu in the editsessionadmin.php script does not contain any options except for the Please Select option.

Does anybody know how to fix the jquery/ajax code in order to perform what I want it to perform?

Below is the editsessionadmin.php code:

            <script type="text/javascript">

            $(document).ready( function(){
            function getModules() { 
            jQuery.ajax({ 
            type: "post", 
            url:  "module.php", 
            success: function(response){ 
            jQuery('#modulesDrop').append(response); 
            } 
            }); 
    });
            }
            </script>


....

<?php

    $moduleHTML = "";  
    $moduleHTML .= '<select name="modules" id="modulesDrop">'.PHP_EOL; 
    $moduleHTML .= '<option value="">Please Select</option>'.PHP_EOL;  
    $moduleHTML .= '</select>'; 


?>

module.php page:

`

     // connect to the database
 include('connect.php');

 /* check connection */
 if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
die();
}

$moduleactive = 1;

$sql = "SELECT ModuleId, ModuleNo, ModuleName FROM Module WHERE ModuleActive = ? ORDER BY ModuleNo"; 


 $sqlstmt=$mysqli->prepare($sql);

 $sqlstmt->bind_param("i", $moduleactive);

 $sqlstmt->execute(); 

 $sqlstmt->bind_result($dbModuleId,$dbModuleNo,$dbModuleName);


$moduleHTML  = "";  

 while($sqlstmt->fetch()) { 
     $moduleHTML .= sprintf('<option value="%1$s_%2$s_%3$s">%1$s - %2$s</option>'.PHP_EOL, $dbModuleNo, $dbModuleName, $dbModuleId);
} 


echo $moduleHTML; 

 $sqlstmt->execute(); 


?>`
  • 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-15T15:18:21+00:00Added an answer on June 15, 2026 at 3:18 pm

    Your code looks like it is creating a function on document ready, but never calling it. Also it looks like you have your brackets a little out of order. This becomes a little more obvious by indenting the code.

    $(document).ready( function(){
        function getModules() { 
            jQuery.ajax({ 
                type: "post", 
                url:  "module.php", 
                success: function(response){ 
                    jQuery('#modulesDrop').append(response); 
                } 
            }); 
    });
        } <--- This should be swapped with the line above
    

    What you could do is delete the line function getModules() { and the spare } at the end, and then it should work or at least give you another GET in FireBug.

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

Sidebar

Related Questions

I have this javascript code below that uses jquery, it is suppoed to be
I have this jQuery code: $(document).ready(function() { $.ajax({ url: pages/+page+.php, cache: false }).done(function( html
I have jQuery code which looks something like this on Button1 Click $('table.result_grid tbody
Below I have a jquery code which includes a textbox where the user can
Below is part of the jquery code I have which displays the file input
Below is part of the jquery code I have which displays the file input
I have a list generated with PHP that looks like the HTML code below.
The below code is very simple. I have a jQuery autocomplete bound to an
I am getting JQUERY undefined error. Do you have any idea (code below). <%@
I am trying to fetch wcf service from jquery. I have written below code

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.