是否可以将变量从一个页面传递到下一页并同时运行该变量?
我想做的是有一个搜索栏,允许用户进行搜索,并在输入时打开一个包含数据表的新页面。我想将他们在搜索栏中输入的内容传递到数据表的搜索栏中并显示结果。
<!-- START Search form-->
<form role="search" action="searchalltransactions.cfm" class="navbar-form">
<div class="form-group has-feedback">
<input type="text" placeholder="Type and hit enter ..." class="form-control">
<div data-search-dismiss="" class="fa fa-times form-control-feedback"></div>
</div>
<button type="submit" class="hidden btn btn-default">Submit</button>
</form>
<!-- END Search form-->
这样的事情可能吗?我对此并不熟悉,只是想学习如何做到这一点(如果可能的话)。
如何将其传递到下一页上的(数据表创建的搜索)searchalltransactions.cfm
jquery 数据表创建的搜索
<input class="form-control input-sm" placeholder="" aria-controls="processing1" type="search">
最佳答案
这有点愚蠢,但您可以在数据表初始化后在结果页面上执行此操作:
<cfoutput>
<script>
table.search( '#url.search#' ).draw();
</script>
</cfoutput>
请记住这是在 JavaScript 中运行的。所有数据库结果都被加载到浏览器中,然后进行过滤。如果您要 GET 或 POST 搜索,则应该在数据库查询中进行过滤/搜索。
关于javascript - 将变量传递到另一个页面并运行该变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43149317/