coldfusion ajax passing parameters

I’m on CF 8. I have 2 test cfm files – Tst_Name.cfm, had javascript call other cfm file to get a name list – Tst_Name.cfm.  The code works now, able to display a name list when start typing.  Now I need to pass 2 additional parameters, sdate and loc to Tst_Name.cfm.  How can I  do that?  Thank you very much for helpp!!
====== Tst_Name.cfm =======================================================
<cfparam name="url.start_date" default = "#DatePart('yyyy',now())#-01-01">
<cfparam name="url.end_date" default = "#DateFormat(DateAdd("m",2,Now()),"yyyy-mm-dd")#">
<cfparam name="url.sdate" default="">
<cfparam name="url.loc" default="">
<script type="text/javascript">
      function setSuggestlist(e)
      {
            document.getElementById('name').value = "";
            var sdate = document.getElementById('startDate').value;
            var loc = e;
             alert("startDate= "+sdate+" loc= "+ loc);
             frame1 = new suggest();
            frame1.createIframe('frame1','name','id','#C6D5D5','#F4F7F7', "'Tst_Name.cfm?NoMenu=yes&NoHeader=Yes&NoFooter=Yes&mytext='");
      }
</script>
<cfoutput>
<table bgcolor="##99CCCC" width="60%" >      
      <tr><td>&nbsp;</td></tr>
          <tr>
            <td align="RIGHT" nowrap>Start / End Date:</td>
            <td><input id="startDate" name="startDate" type="text" size="8" maxlength="10" value="#url.start_date#" > &nbsp;&nbsp;&nbsp;To&nbsp;&nbsp;&nbsp;
             
      <input id="endDate" name="endDate" type="text" size="8" maxlength="10" value="#url.end_date#" > </td></tr>
    <tr>      <td align="RIGHT" nowrap><b>Location:</b>&nbsp;</td>
      <td colspan="2" align="left">
        <INPUT TYPE="RADIO" NAME="loc" VALUE="s" onclick="setSuggestlist('s')">Schaumburg
      <INPUT TYPE="RADIO" NAME="loc" VALUE="o" onclick="setSuggestlist('o')">Chicago
              </td> </tr>
    <tr><td align="RIGHT" nowrap><b>Name:</b>&nbsp;</td>
      <td><input type="text" class="suggest" size="60" id="name" name="name" value=""  /></td>
       </tr><tr><td>&nbsp;</td></tr>      <tr><td>&nbsp;</td></tr>       
</table>
</cfoutput>
=============== Tst_Name.cfm ===========================
<cfparam name="url.sdate" default="">
<cfparam name="url.loc" default="">
<cfif isdefined('url.mytext') and url.mytext NEQ ''>
  <cfquery name="rs" datasource="#session.client_storage#">

        DECLARE
            @NameTB TABLE (
                id      int,
                name VARCHAR( 30 ),
                loc_ind      char(10),
                S_date date
            )
        ;
         INSERT INTO @NameTB
        ( id, name, loc_ind, S_date  ) VALUES ( 1, 'Sarah Doe', 's', '2015-01-01' );
         INSERT INTO @NameTB
        ( id, name, loc_ind, S_date  ) VALUES ( 2, 'Sarah Lee', 's', '2014-01-01' );
        INSERT INTO @NameTB
        ( id, name, loc_ind,S_date  ) VALUES ( 3, 'John Doe', 's', '2015-01-01' );
        INSERT INTO @NameTB
        ( id, name, loc_ind,S_date  ) VALUES ( 4, 'John Lee', 's', '2014-01-01' );
        INSERT INTO @NameTB
        ( id, name, loc_ind,S_date  ) VALUES ( 5, 'Mary Doe', 's', '2015-01-01' );
        INSERT INTO @NameTB
        ( id, name, loc_ind,S_date  ) VALUES ( 6, 'Mary Lee', 's', '2014-01-01' );
        INSERT INTO @NameTB
        ( id, name, loc_ind,S_date  ) VALUES ( 7, 'Sarah Smith', 'o', '2015-01-01' );
        INSERT INTO @NameTB
        ( id, name, loc_ind,S_date  ) VALUES ( 8, 'Sarah Key', 'o', '2014-01-01' );
        INSERT INTO @NameTB
        ( id, name, loc_ind,S_date  ) VALUES ( 9, 'Katie Smith', 'o', '2015-01-01' );
        INSERT INTO @NameTB
        ( id, name, loc_ind,S_date  ) VALUES ( 10, 'Katie Key', 'o', '2014-01-01' );
         INSERT INTO @NameTB
        ( id, name, loc_ind,S_date  ) VALUES ( 11, 'John Smith', 'o', '2015-01-01' );
         INSERT INTO @NameTB
        ( id, name, loc_ind,S_date  ) VALUES ( 12, 'John Key', 'o', '2014-01-01' );
       
        SELECT
            t.id  myid,
            t.name myvalue
        FROM
            @NameTB t
        WHERE
              lower(rtrim(t.name)) like '#replace(lcase(url.mytext), '*', '%', 'all')#%'
        ;
    </cfquery>
    <cfcontent type="text/html" reset="yes">
    <cfoutput query="rs">
    <div id="#trim(rs.myid)#" onClick="window.parent.mythis.setvalue(this);" onMouseOver="window.parent.hover_color(this);" onMouseOut="window.parent.blur_color(this);">#trim(rs.myvalue)#</div>
    </cfoutput>
</cfif>
jfreeman2010Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

hieloCommented:
Try:
<script type="text/javascript">
      function setSuggestlist(e)
      {
            document.getElementById('name').value = "";
            var sdate = document.getElementById('startDate').value;
            var loc = e;
             alert("startDate= "+sdate+" loc= "+ loc);
             frame1 = new suggest();
            frame1.createIframe('frame1','name','id','#C6D5D5','#F4F7F7', "'Tst_Name.cfm?sdate" + encodeURIComponent(sdate) + "&loc="+encodeURIComponent(loc) + "NoMenu=yes&NoHeader=Yes&NoFooter=Yes&mytext='");
      }
</script>

Open in new window

0
jfreeman2010Author Commented:
Hi hielo,

Thank you very much for the help.  I did it what you suggest and edited the select as follow, it cause the ajax did not return any result:

 SELECT
            t.id  myid,
            t.name myvalue
        FROM
            @NameTB t
        WHERE
       
              lower(rtrim(t.name)) like '#replace(lcase(url.mytext), '*', '%', 'all')#%'
        AND   loc_ind =  '#url.loc#'
        ;
0
jfreeman2010Author Commented:
If I changes to this, the ajax works - means it give me a  name list:

SELECT
            t.id  myid,
            t.name myvalue
        FROM
            @NameTB t
        WHERE
       
              lower(rtrim(t.name)) like '#replace(lcase(url.mytext), '*', '%', 'all')#%'
        AND   loc_ind =  'o'
        ;
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

jfreeman2010Author Commented:
So it seems 'url.loc' in Tst_Name.cfm file did not get any value from Tst_suggestBox.cfm. Any suggestion?  Thank you!!
0
hieloCommented:
On my previous post, there is a missing:
"=" immediately after "sdate"
"&" immediately before "NoMenu"


frame1.createIframe('frame1','name','id','#C6D5D5','#F4F7F7', "'Tst_Name.cfm?sdate=" + encodeURIComponent(sdate) + "&loc=" + encodeURIComponent(loc) + "&NoMenu=yes&NoHeader=Yes&NoFooter=Yes&mytext='");
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jfreeman2010Author Commented:
yes, what works.  I am sorry, I should check it.

Thank you very much for your help!!!
0
jfreeman2010Author Commented:
Thank you!!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
AJAX

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.