How do i call my function CF

Hi, I need your help please,I am new to cold fusion my problem is how do i call my function in cold fusion.,also can you please correct me in declaring the function and using the array i am not sure of that i just tried.

myquery.cfm


 <cfif IsDefined(empcode)>
             getmyCodeCode(mycode)
  </cfif>


 <cfscript>
   function getmyCodeCode(empcode) {
      Select emp_code,empname,emplastname,emp_position where emp_code = '#empcode#'

           myarray = ArrayNew(1)
           myarray[1]=#emp_code#
           myarray[2]=#empnamel#
            myarray[3]=#emplastname#
         myarray[4]=#emp_position#
         serjson= SerializeJSON(myarray);
         return serjson
   }
</cfscript>


myparent.cfm


  $.ajax({
      type: 'post',
      data:{empcode:empcode},
      url: 'myquery.cfm',
     success:function(emp){
           console.log(emp);
  }
});



Thank you in advance.