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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T23:43:27+00:00 2026-05-21T23:43:27+00:00

I’m using the basic $.get() script for retrieving whether or not a record exists

  • 0

I’m using the basic $.get() script for retrieving whether or not a record exists already in the database. The page called returns either yes or no depending if a record is found. Right now, it returns a blank value regardless.

This is the snippet of HTML with the specific input fields

<p><label for="participant_id">Please enter the Participant ID:</label>
    <cfinput type="text" name="participant_id" value="#attributes.stPages.Content.ParticipantId#" required="yes" message="Enter the Participant ID" />
    <cfif Len(trim(attributes.stPages.Content.ParticipantId)) eq 0>
        <cfinput type="button" name="checkunique" value="Check if Unique" />
        <cfinput type="hidden" name="participant_id_valid" value="false" />
    </cfif></p>

This is the calling script

$("#checkunique").click(function() {
    $.get('participant_id_check.cfm?participant_id=' + $('#participant_id').val(), function(data) {
        result = data.replace(/^\s+|\s+$/g,"");
        if (result) {
            $('#unique-result').text('Your Participant ID is accepted');
        } else {
            $('#unique-result').text('Your Participant ID has already been used.  Please enter another');
        }
    });
});

Here is the calling page. If I call it directly in the URL it works fine.

<!--- Check the database to ensure that the participant ID entered doesn't already exist (only for new entries). --->
<cfparam name="url.participant_id" default="" type="string" />

    <cfquery name="checkID" datasource="#APPLICATION.strConfig.datasource#">
        SELECT sessionid
        FROM tblsessions
        WHERE participant_id = <cfqueryparam cfsqltype="cf_sql_varchar" value="#url.participant_id#" null="no" />
    </cfquery>

    <!--- No record found; value is unique --->
    <cfif Not checkID.RecordCount>
        Yes 
    <cfelse>
        No <!--- Record found; value is not unique--->
    </cfif>
  • 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-21T23:43:28+00:00Added an answer on May 21, 2026 at 11:43 pm

    You are not using $.get correctly, try this:

    $("#checkunique").click(function() {
        $.get('participant_id_check.cfm',
              {'participant_id': $('#participant_id').val()}, function(data) {
            result = data.replace(/^\s+|\s+$/g,"");
            if (result) {
                $('#unique-result').text('Your Participant ID is accepted');
            } else {
                $('#unique-result').text('Your Participant ID has already been used.  Please enter another');
            }
        });
    });
    

    Also a side point, you have nothing with the id='participant_id' so $('#participant_id').val() probably won’t get you anything

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

Sidebar

Related Questions

No related questions found

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.