Invoke ColdFusion function using AJAX

前端 未结 6 751
Happy的楠姐
Happy的楠姐 2020-12-01 16:58

I need to invoke a ColdFusion function(present in a .cfm file) when the user clicks on a link. And I would like to do it using jQuery. I have a jQuery snippet which looks li

6条回答
  •  醉话见心
    2020-12-01 17:20

    If you have multiple functions in your cfm(even if you don't), put them in a cfc. Then you can use the following url pattern to invoke a specific method.

    cfc named myEntityWS.cfc

    
      
        
        
          your code here
        
          
            #cfcatch.Detail#
    #cfcatch.Message#
    #cfcatch.tagcontext[1].line#:#cfcatch.tagcontext[1].template#

    Javascript

    $.get('myEntityWS.cfc?method=updateDescription&value=someValue');
    

提交回复
热议问题