- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
基本上,我从一个 CFM 调用另一个 CFM,它创建一个对象,调用该对象上的多个方法并登录用户;否则它会在屏幕上打印错误。
有没有办法获取 CFM 并将 JSON 对象发送到调用它的文件,而不是打印错误?
这是我的ajax:
// 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");
}
});
});
最佳答案
在您的 CFM 页面上,您可以有 <cfif>
检查页面是否是通过 ajax 请求的语句。如果是ajax,则返回一个json对象。
<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);
}
关于jquery - Coldfusion:将 json 从一个 CFM 传递到另一个 CFM?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8857802/
基本上,我从一个 CFM 调用另一个 CFM,它创建一个对象,调用该对象上的多个方法并登录用户;否则它会在屏幕上打印错误。 有没有办法获取 CFM 并将 JSON 对象发送到调用它的文件,而不是打印错
我很难弄清楚如何将 css 文件和 cfm 文件添加到 cfm 文件。我是 coldfusion 的新手,我尝试了以下方法,但是当我渲染页面时,它显示为空白。 cfm 文件也是如此,没有出现,我按照在
我正在尝试将一个变量从一个 jsp 页面传递到该 jsp 内导入的 cfm。 以下是字符串的存储方式 ( http://www.tenaquip.com/shop/optin-form-test.js
如果我的站点有 protected 后端,并且我希望使用 application.cfm 文件,我如何判断哪些页面使用应用程序文件 sa,哪些页面不使用。 index.cfm update/appli
我正在将文本字段值从父 cfm 页面传递到我在单击按钮或链接后打开的子窗口。 function LaunchPopup(page) { OpenWi
我有一个 javascript 表单,可以链接到一个 .cfm 表单并完美地工作,该表单可以将电子邮件发送给正确的人。如果选择选项 A,我想向一个人发送电子邮件;如果选择选项 B,我想向另一个人发送电
我正在尝试开发一个 1 页的迷你应用程序,可以使用 2 行代码进行部署。 这将位于不同的域上,我们称之为 http://theirdomain.com/client.html 然后在加载程序文件中
我知道这个问题可能有点学术性,但我只是试图了解 ColdFusion 中的这种行为。 在 CFM 上访问 REQUEST 范围时,比在方法中访问 REQUEST 范围花费的时间更少。据我所知,唯一的区
我们使用coldfusion 9,并且对我们的站点用于发送电子邮件的个人SMTP 帐户有发送限制。我想根据一天中的什么时间在两台服务器之间交替。 我想在 Applicat
已关闭。此问题不符合Stack Overflow guidelines 。目前不接受答案。 这个问题似乎不是关于 a specific programming problem, a software
我有一个名为“conv”的函数,我的应用程序中的多个程序都需要它。因此,我没有将它包含在每个程序中,而是将它放在 Application.cfm 中,如下所示: 当我使用函数“conv
我有一台在 Mac OS X El Capitan 上运行 Lucee 和 Tomcat 的开发机器。 Lucee 运行良好,但当我调出我的开发站点时,映射到 admin.local,我必须输入“ad
我们有多个带有 IIS7 和 ColdFusion 的服务器。有些是CF9,有些是CF10。以“.cfm”(小写)结尾的 Coldfusion 页面在两者上都正确呈现。但是,如果您输入“.CFM”(大
我的应用程序的单个文件中有几个逻辑相关的 UDF。 问题是单个文件应该是 CFC 文件还是 CFM 文件?为什么? 我引用了以下几个链接,但它们更多地解释了如何实现该解决方案。我只想知道哪个更好
我在我的应用程序范围内放置了一个组件,以便在所有请求之间共享它,并且它包含一个 cfm 模板:
我正在修改一个用 Coldfusion 编码的现有 Web 应用程序。在现有代码中,大部分文件夹包含一个 Application.cfm 文件,该文件设置应用程序变量 但是,我对这些应用程序的部分修改
我有 2 个使用类似布局构建的 ColdFusion 应用程序。它们大约是同时 build 的。我最近将我的本地服务器升级到 ColdFusion 9。它们在本地都运行良好,但是当我通过我的 IP 访
是否可以使用某些 URL 参数从另一个 cfm 文件调用 cfm 文件? cfinclude 不起作用,因为它只包含内容。 最佳答案 当您使用 时,调用该文件的页面中的任何可用值都可以在您将包含的页
您在使用 View 的自定义标记来提高可维护性方面是否取得过成功? 使用自定义标签是否比使用基本标签有任何好处 ? 您之前编写过任何可以提高 HTML 可维护性的自定义标记吗? 谢谢 最佳答案 是的
我正在努力通过 301 重定向修复所有 URL,使其变得更短。我已经修复了几乎所有问题,但是有一个以 .cfm 结尾的 url 不会重写。 FROM: http://www.mydomain.com/
我是一名优秀的程序员,十分优秀!