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/