weixin_33671935 2015-09-28 05:22 采纳率: 0%
浏览 33


I'm hitting a wall with an issue and it's been probably more hours than I care to admit tracking this thing down.

Specifically what I have is a jQuery AJAX call that posts some data to a .cfc I call the method and I pass in some arguments run a few database queries and then nothing is returned. I then use the success method of the AJAX function to continue on.

I developed this on a ColdFusion 11 server and it works a treat. However in my recent move to a Lucee server I am having all kinds of issues with this.

First I noticed that the success methods weren't being called. However Firebug is reporting a 200 OK on the call. So I checked further and the databases queries have all run within the method. Beyond that the Lucee logs looks clean as well and acknowledges that the database queries were run successfully. So everything is reporting fine (of the things I know to check). I have doen the basics and tried different machines and different browsers in the off chance this was specific, but nothing budged.

I noticed that Firefoxes Inspect Element was throwing a no element found error and upon further inspection it was returning that the arguments I was posting to the cfc were undefined. This cause me to dig a bit further and I noticed that it was returning this error 'XML Parsing Error: no element found' Still saying that the return was 200 OK, but not ok enough to go through to the success method of the AJAX call.

Other ideas I had and attempted with no real results were enabling CORS, including a returntype of JSON (which removed the XML error, but did little else).

Any ideas of what I can try, I'm starting to wonder if the entire Lucee setup was botched and I need to scrap it and reinstall?

Thanks for any help or ideas you can thrown in.

Edit: Apologies for not attaching code, as this appeared to be connected to a server set up I was naively hoping that someone would go, "Yeah you need to set this setting and modify this file and you're all good!" Then we'd all have a laugh at Tomcat.

I'm assuming with the first comment saying, "Show us your code!" that this is not the case. So taking the hint I put together a minimum test case which still confirms my original issue:


<!--- jQuery 2.1.4 --->
<script src="./jQuery-2.1.4.min.js"></script>

$(document).ready(function() {
        type: "post",
        url: "./test.cfc",
        data: {
            method: "test",
            var1: "var1",
            var2: "var2"
        success: function(result) {
            alert('Hello Friend!');



    <!--- Test Function --->
    <CFFUNCTION NAME="test" ACCESS="remote">

        <CFARGUMENT NAME="var1" />
        <CFARGUMENT NAME="var2" />

            Var 1: #var1#<br />
            Var 2: #var2#

    <!--- End Test Function --->


And probably more important I'm on Lucee

As before any help is always greatly appreciated.

  • 写回答

1条回答 默认 最新

  • lrony* 2015-09-28 12:12

    So I took a nap and came back at this issue. I'm thinking this has very little to do with the code or the flavour of ColdFusion and more to do with the webserver.

    I started playing with the various dataTypes available and was starting to see changes in the return result. They weren't immediately apparent as they were preceeded by a significant amount of white space.

    So part of this issue is my own bad coding. I usually only use a dataType when I need something specific returned, e.g. JSON, otherwise I leave it out and there will be an "intelligent guess" made at what is being returned. I'm guessing that the major difference in my scenario is using Apache HTTP Server (worked) versus Apache Tomcat (didn't work) so when I included the dataType: 'text' and then liberally used the jQuery function .trim() I could achieve what I wanted.

    I also consequently made my code a bit better in the process.

    Hopefully this helps someone going nuts on (at least to me) difficult to diagnose issue that was failing semi silently.




  • ¥15 虚拟机打包apk出现错误
  • ¥30 最小化遗憾贪心算法上界
  • ¥15 用visual studi code完成html页面
  • ¥15 聚类分析或者python进行数据分析
  • ¥15 逻辑谓词和消解原理的运用
  • ¥15 三菱伺服电机按启动按钮有使能但不动作
  • ¥15 js,页面2返回页面1时定位进入的设备
  • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝