Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

why this is not working jquery

New Here ,
Mar 19, 2010 Mar 19, 2010

hi here is my code

help.cfm:


<script src="jquery.js"></script>
<script type="text/javascript">

     $('#search').bind('keyup',updateQuery);

    function updateQuery(){
        $('#userlist').load('query.cfm?search='+ $('#search').val() );
    }

    $(document).ready(function(){
        $('#userlist').load('query.cfm');
    });

</script>

Search: <input id="search" type="text" />

<br />
<br />

<div id="userlist"></div>

query.cfm:

<cfparam name="search" type="string" default="">
<cfquery name="q" datasource="art">
    SELECT LastName,  FirstName
    FROM artists
     <cfif len(search)>
    WHERE FirstName
   LIKE <cfqueryparam cfsqltype="cf_sql_varchar" value="%#search#%" />
    </cfif>
    ORDER BY  FirstName
</cfquery>

<cfoutput>#q.recordCount# User(s) Found</cfoutput>
<br />
<br />
<cfoutput query="q"> <a href="##" style="color: blue;"> #FirstName# </a><br />
</cfoutput>

this is my code but when i enter some thing in search box ia m not getting exact result and it is displaying all the records and not what i need.

will some one will help me in this

Thanks.

this is result :


13 User(s) Found

Aiden
Anthony
Diane
Elicia
Ellery
Emma
Jeff
Lori
Maxwell
Paul
Raquel
Taylor Webb
Viata

TOPICS
Getting started
317
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 19, 2010 Mar 19, 2010
LATEST

Your problem might be here.

<cfif len(search)>

I troubleshoot if/else problems like this.

if something

yes

else

no

display what that something actually is.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources