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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:31:03+00:00 2026-05-27T11:31:03+00:00

Basically the problems that I am having is that I have a section of

  • 0

Basically the problems that I am having is that I have a section of script that is set to execute when the select box “graded” changes. Basically what happens in the document never becomes ready. When I use Chrome’s console to print out the studentid and graderid values they are empty. I put an “exit();” function in the displayeval.php page and was able to find out that the document never becomes ready.

I realize a lot of this code is messed up and very novice, but I am working like a crazy man to finish up this project before the end of the week for class and I just want it to work.

$(document).ready(function () {
    $('#graded').change(function () {
        var studentid = $('#studentid').val();
        var graderid = $(this).val();
        $.get("displayeval.php?graderid=" + graderid + "&studentid=" + studentid, function (data) {
            $('#behavior-290').val(data.comment);
        }, "json");
    });
});

instructoreval.php

    <?php
include('includes/header.php');
$student_id=$_GET['studentid'];
if($session->userlevel>=8)

//if they are an instructor
{
 if(isset($_POST['Submit'])){
      $query="SELECT * FROM Behavior b, Groups g WHERE g.GROUP_ID=" . $session->GROUP_ID . " AND b.CONTRACT_ID=g.CONTRACT_ID";
      $btwo = mysql_query($query) or die(mysql_error());
      $numB = mysql_num_rows($btwo);
      $query2="INSERT INTO Eval (STUDENT_ID, Grader_ID, GROUP_ID, Grade) VALUES (" . $_POST[graded] . ", " . $session->STUDENT_ID . ", " . $session->GROUP_ID . ", '10')";
      mysql_query($query2) or die(mysql_error());

      $evalid = mysql_insert_id();
      for($i=0;$i<$numB;$i++){ 
        $r2 = mysql_fetch_array($btwo);
        $query3="INSERT INTO EvalComment (CONTRACT_ID, BEHAVIOR_ID, Comment, EVAL_ID) VALUES (" . $r2[CONTRACT_ID] . ", " . $r2[BEHAVIOR_ID] . ", \"" . $_POST[$r2[BEHAVIOR_ID]] . "\", " . $evalid . ")";
        mysql_query($query3) or die(mysql_error());
      };
      $qfour = mysql_query("SELECT * FROM users WHERE GROUP_ID=" . $session->GROUP_ID . " AND STUDENT_ID=" . $_POST[graded]);
      $rfour = mysql_fetch_array($qfour);
      popup("Your comments for " . $rfour[lname] . ", " . $rfour[fname] . " have been submitted.");
    };


            $link = mysql_connect("localhost","drallen1","unicode") or die(mysql_error);
            mysql_select_db("drallen1");

            $qsix = mysql_query("SELECT * FROM users u WHERE u.GROUP_ID=" . $session->GROUP_ID . " AND NOT EXISTS(SELECT * FROM Eval e WHERE u.STUDENT_ID=e.STUDENT_ID) AND u.STUDENT_ID!=" . $session->STUDENT_ID);
            $numE = mysql_num_rows($qsix);
            /***************************************************
            //WHEN numE == 0 GO TO PIE CHART
            ***************************************************/
            //QUERY
            $qtwo = mysql_query("SELECT * FROM Behavior b, Groups g WHERE g.GROUP_ID=" . $session->GROUP_ID . " AND b.CONTRACT_ID=g.CONTRACT_ID");
             // match eval id
            $numB = mysql_num_rows($qtwo);

            if($numE>1)
              $page="evalform.php";
            else
              $page="evalprocess.php";

              echo "<form action=$page method=\"POST\">";?>

            <script type="text/javascript">
                $(document).ready(function(){
                            $('#graded').change(
                                function() {
                                var studentid = $('#studentid').val();
                                var graderid = $(this).val();

                                $.get( "displayeval.php?graderid=" + graderid + "&studentid=" + studentid,
                                   function(data){
                                        $('#behavior-290').val(data.comment);
                                   }, "json");
                            });
                    });
        </script>
            <input type="hidden" name="studentid" id="studentid" value="<?php echo $_GET['studentid'];?>" />
            Student: <select name="graded" id="graded">
              <option selected="selected">Please Select a Student to Grade</option>
              <?php for($i=0;$i<$numE;$i++){
                $rsix = mysql_fetch_array($qsix);?>
                <option value="<?php echo $rsix[STUDENT_ID]?>"><?php echo $rsix[fname] . " " . $rsix[lname]?></option>
              <?php };?>
            </select></br></br>

            <!--$qthree = mysql_query("SELECT EVAL_ID FROM Eval WHERE GRADER_ID=" . $student_id. " AND STUDENT_ID=" . graded.value ); -->

            <?php for($i=0;$i<$numB;$i++){ 
            //result of qtwo
              $rtwo = mysql_fetch_array($qtwo);
              echo "Behavior: <input name=\"BEHAVIOR_ID\" type=\"text\" value=\"" . $rtwo[BehaviorName] . "\" readonly=\"readonly\"/> </br>";

                //$queryshit="SELECT Comment FROM EvalComment WHERE EVAL_ID=RESULTFROMQTHREE AND BEHAVIOR_ID=" . $rtwo[BEHAVIOR_ID];
                //$comments;

              echo "Comments: <textarea name=\"" . $rtwo['BEHAVIOR_ID'] . "\" id=\"behavior-" . $rtwo['BEHAVIOR_ID'] . "\" rows=\"5\" cols=\"50\">". $comments . "</textarea> </br>"; ?>
            <?php };?>
            </br>
            <input type="submit" value="Send!" name="Submit"/>
          </form>
        </body>

   </html>

    <? include("includes/footer.php"); 
  }else{
  echo "You don't have access to this.";
};?>

displayeval.php

    <?php
include('include/session.php');


$grader_id=$_GET['graderid'];
$student_id=$_GET['studentid'];

$query="SELECT EVAL_ID FROM Eval WHERE GRADER_ID=". $grader_id . " AND STUDENT_ID=" . $student_id;

$result=mysql_query($query) or die(mysql_error());
$data=mysql_fetch_array($result);

$eval_id=$data['EVAL_ID'];

$query="SELECT BEHAVIOR_ID,Comment comment FROM EvalComment WHERE EVAL_ID=". $eval_id;
$result=mysql_query($query) or die(mysql_error());

$data2=mysql_fetch_assoc($result);
//print_r($data2);


// query database based on GET params

// fetch result
// $mysql_row = mysql_fetch_assoc()

// display in JSON: 
echo json_encode( $data2 );

this is the result of the displayeval(displayeval.php?graderid=0&studentid=241654664) page

{"BEHAVIOR_ID":"1","comment":"Write Write Write Write Write Write Write Write Write Write Write Write Write Write Write Write Write Write Write Write Write Write Write Write Write Write Write Write Write Write"}
  • 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-27T11:31:04+00:00Added an answer on May 27, 2026 at 11:31 am

    First, make sure the $('#graded') element exists, try:

    $(document).ready(function() {
        alert($('#graded').attr('id'));   // should alert 'graded'
    });
    

    Second, if you are loading it dynamically (after the page has been rendered) you will need to declare the change() method via a $.bind() or $.live() event.

    $('#graded').live('change', function () {
        ...
    });
    

    Finally, be careful with $.change().

    For checkboxes, you may want to do this:

    $('#graded').change(function(){
        if ($(this).is(':checked')) {
            // the checkbox is now checked, do something
        } else {
            // the checkbox is now UN-checked, do something else
        }
    });
    

    In addition to all that (KISS principle), make sure the jQuery library is in fact being loaded:

    if (jQuery) { 
       alert('jQuery is loaded');
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some localization problems in my webpage. There are basically two problems (that
I'm having problems starting my application. Basically, I have an existing application, but just
I'm having troubles getting this to work. Basically I have a python program that
I have a database that we are having problems with. Somehow the log has
I am trying to do something seemingly simple, yet having problems. Basically, I have
I am having problems with a Python script which is basically just analysing a
I have a pretty simple problem. Basically I have an array called $list that
Basically i am having problems with my code - this is homework so would
Basically I'm having some problems with Z-Index. Although I'm not amazing at CSS I
I'm trying to do some browser automation, but I'm having some problems. Basically, what

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.