Invoke ColdFusion function using AJAX

前端 未结 6 759
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:09

    You don't necessarily need to use "AJAX" (the XML part, specifically), but you can use a remote server call:

    $.get('/execute-function.cfm?func=whatever', function (result) { $('#result').html(result); });
    

    Really depends on what you need to do with the result. The above code will place the HTML result in a div on your page:

    You could use an asynchronous call and parse XML, but I've found that I rarely need either.

提交回复
热议问题