1

I want to implement verifyclient in some functions in a cfc. I am aware that the follow syntax will works, but I don't know how to implement it within a ajax call. Example:

<cfajaxproxy cfc="cfc.cls_queries" jsclassname="cls_queries">

<script type="text/javascript">
  var cfcQuery = new cls_queries(); // reference the cfc object

  ..some functions....()

</script>

And I have another piece of code where I'm using plain Ajax as follow:

$.ajax({
   async:    false,
   type:     "POST",
   url:      "resources/cfc/cls_queries.cfc",
   dataType: "json",
   data: {
      method: "get_someInformation",
      cidm: lv_userID
   },
   success: function(data){}
});

How can I replace the url, data{method, and parameters} with the object (cfcQuery) that reference the cfc?

James A Mohler
  • 11,060
  • 15
  • 46
  • 72
  • Implementation of the verifyclient function is not documented so you may try reverse engineering it if you have strong reasons to do so, but I would rather not. – Henry Mar 18 '15 at 23:23
  • My problem is not with the verifyclient function, it is about replacing the url, and data {method, @params} with the object that reference the ColdFusion component. I am thinking something like $.ajax({ async: false, type: "POST", dataType: "json", cfcQuery.get_someInformation(lv_userID), success: function(data){ } }); – David Dos Santos Mar 18 '15 at 23:28
  • does this help? http://stackoverflow.com/questions/10180544/returning-value-from-coldfusion-cfc-called-with-jquery-ajax – Henry Mar 19 '15 at 00:09
  • 1
    No really, however I figure out the problem: mixing unnecessarily Ajax with cfcQuery variable. Steps: 1-Before the loading the javascript on the cfm, declare the cfajaxproxy, and reference the function within the javascript. 2-At the top of the js, declare the new object that is going to reference the cfc Call the function in the cfc. Example: var data = cfcQuery.get_student( null, id, fname, lname, null, null, null, null ); And after that parse the success result (data) to manipulate the content – David Dos Santos Mar 19 '15 at 04:59

1 Answers1

1

As David mentioned. You may use the following code to make the ajax call:

<cfajaxproxy cfc="cfc.cls_queries" jsclassname="cls_queries">
<script type="text/javascript">
    var cfcQuery = new cls_queries();
    var result = cfcQuery.get_someInformation(cidm = lv_userID);
</script>
Pankaj
  • 1,731
  • 1
  • 13
  • 15