[英]How to replace iframe with AJAX in ColdFusion
I am using ColdFusion code, and in my code, my code is built inside a table using ColdFusion, where I am setting a variable and creating a query, and then I am passing that variable in an iframe and I am opening my other page called question.cfm in my questionbuilder.cfm page through iframe. 我正在使用ColdFusion代码,并且在我的代码中,我的代码是在使用ColdFusion的表中构建的,在该表中设置变量并创建查询,然后在iframe中传递该变量,并打开另一个名为通过iframe在我的questionbuilder.cfm页面中的question.cfm。 How can I replace my code and do this using AJAX, as I have to remove the iframe and use AJAX and Bootstrap?
我必须替换iframe并使用AJAX和Bootstrap,才能替换代码并使用AJAX做到这一点?
<div class="greyborder mediumtext" style="height:expression(document.body.clientHeight-document.getElementById('topBar').scrollHeight-40)" id="divPaths">
<cfset builderURL="#request.DomainProtocol##request.DomainURL##ChangeManagerHome#question.cfm?processid=#processid#&category=#category#" />
<cfif isDefined("URL.pView")>
<cfset builderURL = builderURL & "&pView=#URL.pView#" />
</cfif>
<cfif isDefined("mode") and (mode eq "Add" or mode eq "Edit")>
<cfset builderURL = builderURL & "&mode=#mode#" />
</cfif>
<cfif isDefined("maxrows") and IsNumeric(maxrows) and maxrows gt 0>
<cfset builderURL = builderURL & "&maxrows=#maxrows#" />
</cfif>
<cfif isDefined("pathID") and IsNumeric(pathID) and pathID gt 0>
<cfset builderURL = builderURL & "&pathID=#pathID#" />
</cfif>
<cfif isDefined("qnID") and IsNumeric(qnID)>
<cfset builderURL = builderURL & "&qnID=#qnID#" />
</cfif>
<cfif isDefined("pqn") and IsNumeric(pqn)>
<cfset builderURL = builderURL & "&pqn=#pqn#" />
</cfif>
<cfif isDefined("topt") and IsNumeric(topt)>
<cfset builderURL = builderURL & "&topt=#topt#" />
</cfif>
<cfoutput>
<iframe src="#builderURL#" name="ifrShowQuestionBuilder" id="ifrShowBuilder" width="100%" frameborder=0 height="100%"></iframe>
</cfoutput>
</div>
I guess you are looking for something like this. 我想您正在寻找类似的东西。
Create a new cfm file with the following code, make sure it's in the same folder of your question.cfm file, and test it. 使用以下代码创建一个新的cfm文件,确保该文件位于question.cfm文件的同一文件夹中,然后进行测试。
<cfset builderURL="question.cfm?processid=1&category=2&etc=3..." />
<!DOCTYPE html>
<html lang="en">
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script>
$(document).ready(function () {
$('#manual_trigger').click(function(){
$('#divPaths').load("<cfoutput>#builderURL#</cfoutput>");
});
});
</script>
</head>
<body>
<button id="manual_trigger">load</button> <br><br>
<div id="divPaths"> </div>
</body>
</html>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.