Have the same problem. Ajax and Post do not play well together. Last I checked it is a browser problem.
Using “GET” is a problem too if you need to ajax a lot of data. .
If you are using the ajax to validate a page, a good work around is to open a dhtml iframe window (see http://www.dynamicdrive.com/dynamicindex8/dhtmlwindow/index.htm) and then do the validation in popup window.
As you are validating, use cfflush to show what’s going on:
Checking value 1: Pass
Checking value 2: Pass
Checking value 3: Fail - date range is not valid.
In the past, POST and Ajax have not been an issue for me. Even on my own environment (OSX/Apache/CF) this particular scenario works perfectly. I did not encounter this problem until switching my code to the IIS/CF environment. The real problem seems to be CF on IIS when using POST in a cross domain script. Normal Ajax POSTs work fine in the IIS/CF environment when they are not cross domain.
Have you posted that same data to your page via an HTML/CF form to verify that your error isn't caused by your page logic?
Yes, the POST works fine when the code is in the Apache/CF combination. But when the code is running on the IIS/CF combination, it returns a 500 error. I have a decent amount of experience and I have never seen CF logic cause a 500 error. I am really just trying to go into a 3 step decision tree and return a bit of text. The logic works. Posting to the logic works, until the code is in IIS. I really think there is some sort of permissions or delegation issue between IIS and CF when IIS sees a POST come across from another domain. I just don't know that much about IIS.
Just to test the obvious, does *ANY* cfml resource work correctly on the aformentioned IIS/ColdFusion connection?
You have confirmed that ColdFusion is set up properly, correct.
I speak from experience, when recently a newly set up IIS website would only return 500 errors, becasue we had forgot to run the web server connector tool as the final step of configuring IIS and ColdFusion to work together.
Yes, I have multiple applications and hundreds of users in constant use of the IIS/CF environment. This particular .cfm is in an application that is running just fine. I have Ajax posts running in all the applications. This is just the first cross domain ajax post I have tried to do to the IIS/CF environment.
It was about a year ago when we tried to implement ajax POST that we saw the same 500 error. Ajax GET worked fine, ajax POST had intermittent successes. Sometimes it worked, sometimes it did not. It was bad enough that we had to create a workaround which is still in production today.
I remember googling the error and eventually found a document that confirmed it problem as a bug. It’s been so long that I can’t remember exactly if it said the problem was CF or the browser or apache. (We are CF / Apache / ie and ff).
Wish I could find that doc again…I’ll spend some more time looking…. can you supply the whole error message?
I have not found a way to get to the error. The only thing that comes back is the ugly IIS 500 page. There is no verboseness or anything of the sort.
I guess there would not be an error message per say. In the onreadystatechange function can you alert the xmlhttp.status if the status is not 200? I’m guessing it will be 500.