Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/426.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何使用<;脚本src="&引用&燃气轮机;在第页中插入表单的步骤_Javascript_Php_Jquery - Fatal编程技术网

Javascript 如何使用<;脚本src="&引用&燃气轮机;在第页中插入表单的步骤

Javascript 如何使用<;脚本src="&引用&燃气轮机;在第页中插入表单的步骤,javascript,php,jquery,Javascript,Php,Jquery,我有这个剧本 <script type="text/javascript" src="http://localhost/wordpress/wp-content/themes/formsaz/export.php?id=74459533"></script> 我想把它粘贴到我想要的地方,它会为我加载一个表单。export.php中的代码是: <script type="text/javascript"> function get

我有这个剧本

    <script type="text/javascript" src="http://localhost/wordpress/wp-content/themes/formsaz/export.php?id=74459533"></script>

我想把它粘贴到我想要的地方,它会为我加载一个表单。export.php中的代码是:

    <script type="text/javascript">

    function getQuery(name){
    if(name=(new RegExp('[?&amp;]'+encodeURIComponent(name)+'=([^&amp;]*)')).exec(location.search))
    return decodeURIComponent(name[1]);
    }

    var id = getQuery("id");

    document.write("<div style=\'width:100%; margin:0px auto\'><iframe src='http://localhost/wordpress/wp-content/themes/formsaz/formexport.php?id=" + id + "' scrolling='no' frameborder='0' hspace='0' width='100%' height='100%'></iframe></div>");

    </script>

函数getQuery(名称){
if(name=(new RegExp('[?&;]'+encodeURIComponent(name)+'=([^&;]*)).exec(location.search))
返回组件(名称[1]);
}
var id=getQuery(“id”);
文件。填写(“”);

这将从数据库获取id并查找数据,然后将创建的数据返回到粘贴第一个脚本的页面。但它不起作用!有什么建议吗?

您可以动态添加脚本(因为export.php返回javascript):

或者添加
iframe

var iframe = document.createElement('iframe');
iframe.style.display = "none";
iframe.src = "http://localhost/wordpress/wp-content/themes/formsaz/export.php?id=74459533";
document.body.appendChild(iframe);

当您的脚本返回数据时,如果可能的话,您还应该考虑一个<代码> Ajax < /Case>调用。

我认为<代码> <代码>只是….js文件……您不能使用<代码>加载PHP文件(带有HTML标记)。为什么不能使它成为一个全局函数,包括脚本一次并调用函数?为什么不能只使用iFrAME,正如您的代码所建议的那样?为什么不
??
var iframe = document.createElement('iframe');
iframe.style.display = "none";
iframe.src = "http://localhost/wordpress/wp-content/themes/formsaz/export.php?id=74459533";
document.body.appendChild(iframe);