• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Ajax and CFC's

Explorer ,
Aug 07, 2007 Aug 07, 2007

Copy link to clipboard

Copied

I am having a 'discussion' and being told that if AJAX calls a cfc method more than once that callingScript1 might get callingScript2's cfreturn info on a heavy AJAX page.
Example:
I run an ajax request to retrieve phone numbers. One call = one phone number.
Can someone set us striaght
TOPICS
Advanced techniques

Views

327

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Aug 07, 2007 Aug 07, 2007

Copy link to clipboard

Copied

First of all, it's not a stupid question.

We have a Batch Payment screen where an Insurance Agent can enter payments for up to 10 policies. As the agent enters a policy number, the system verifies that the agent can access the policy and if so, what is its current status and amounts due.

A fast typist can tab from row to row entering policy numbers faster than the system can turn around policy information. If we couldn't tie the request and response together correctly, we could potentially display the wrong payment amounts for any number of policies.

You have two Javascript functions a request and a response. When the Ajax request goes out to the server, an ID is generated with the request. If some data is to be returned to the browser, you also send along the name of the Javascript function that is to be run when the data returns.

CallingScriptA will not get CallingScriptB's info because neither of them will touch the returned data. They will each have their own return function or will both call the same one. The order in which the data is returned can be an issue. The return data from B may show up before the return data from A. You just have to tell the response function how to handle the data.

In the case of our batch screen, I send along the row index with each request. I'm only using one Request function and one Response function, but the Response function knows where to display or populate data due to the index value. So its possible for multiple calls to a single method in a CFC to never step on each other.

Check out Rob Gonda's AjaxCFC project for some examples and more info.

http://www.robgonda.com/blog/index.cfm/ajaxCFC

http://www.robgonda.com/blog/projects/ajaxcfc/examples/echo/

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Aug 07, 2007 Aug 07, 2007

Copy link to clipboard

Copied

LATEST
cf_menace has covered off the client side but you can still get an overlap if you have not varred your local variables in your cfc methods.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation