English 中文(简体)
冷聚: Pass json from a CFM to another CFM?
原标题:Coldfusion: Pass json from a CFM to another CFM?

基本上,我从另一个CFM调来,该调频台制造了一个物体,用几种方法瞄准这个物体,并将用户登录在其中;否则,它会在屏幕上打印了一个错误。

而是随后印刷Error, 是否有办法采用CFM, 是否将一名JSON物体投到称为Error的档案中?

这里我要说:

// processing the login form using jQuery
    $("#loginForm").submit(function(event){
        // prevents the form from being submitted, the event is the arg to the function
        event.preventDefault();

        // stores the data from the form into a variable to be used later
        dataString = $("#loginForm").serialize();

        // the AJAX request 
        $.ajax
        ({
            type: "POST",
            url: "/helpers/auth/ldap/login_demo.cfm",
            data: dataString,
            //dataType: "text",
            success: function() 
            {
                location.reload();
            },
            error: function(ErrorMsg) 
            {
                $("#hiddenLoginError").show("fast"); 
                $("#loginForm p").css("margin-bottom","3px");
            }
        });

    });
最佳回答

在您的调频网页上,你可以有<条码>和>;cfif>说明,对是否要求该网页加亚x。 如果是麻风树,则归还一只 j子。

<cfset isAjax = (isDefined( cgi.http_x_requested_with ) AND lcase(cgi.http_x_requested_with) EQ  xmlhttprequest )>
...
<cfif isAjax>
  <cfcontent reset="true">{ "result":false, "message": "Login Failure" }<cfabort>
</cfif>

之后,你可以测试答复:

dataType: "json",
success: function(rdata) {
  alert(rdata.message);
}
问题回答

Try:

<cfoutput>#serializeJSON( object )#</cfoutput>




相关问题
JQuery AJAX .load - flash chart doesnt load in IE

An IE issue has me completely stumped. I have a coldfusion page that uses JQuery s AJAX .load function to load in a new flash file that is generated by coldFusion s cfchart tag. This works completely ...

Best Coldfusion Library for OpenID [closed]

I am getting ready to start a project that requires using OpenID within Coldfusion 8. I have found a number of different options and was wondering what has worked the best, get s the most support, ...

Find ColdFusion Generated ID

Is there a way to find the elements generated by ColdFusion s <CFLayout> and <CFLayoutArea> tags? These tags: <cflayout type="tab" name="MyAccount"> <cflayoutarea name="...

ColdFusion COM error

I am upgrading from CF4.5 to CF8. Calls to COM dll s that used to work in version 4.5 now throw a "Complex object types cannot be converted to simple values.." error. The COM object has a few arrays ...

What s the best way to write engine-specific CFML code?

Sometimes it is necessary to write different code for Adobe ColdFusion vs Railo vs OpenBD, due to differences in implementation. Do people have a specific method that they use for this? For example, ...

热门标签