我有一个 php 文件,其中从另一个 PHP 文件中获取一个变量。现在我想将此变量传递给另一个在 Javascript 中给出的 PHP 文件。我怎样才能做到这一点?这是 Uploadify 的代码
<head>
<script type="text/javascript" src="uploadifyit/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="uploadifyit/swfobject.js"></script>
<script type="text/javascript" src="uploadifyit/jquery.uploadify.v2.1.4.min.js">
<script type="text/javascript">
$(document).ready(function() {
//alert('I am ready to use uploadify!');
$("#file_upload").uploadify({
'uploader': 'uploadifyit/uploadify.swf',
'script': 'uploadifyit/uploadify.php',
'cancelImg': 'uploadifyit/cancel.png',
'folder': 'uploads',
'auto': false, // use for auto upload
'multi': true,
'queueSizeLimit': 200,
'onQueueFull': function(event, queueSizeLimit) {
alert(" You can upload " + queueSizeLimit + " files at once");
return false;
},
'onComplete': function(event, ID, fileObj, response, data) {
// you can use here jQuery AJAX method to send info at server-side.
$.post("insert.php", { name: fileObj.name}, function(info) {
alert(info); // alert UPLOADED FILE NAME
});
}
});
});
</script>
</head>
<body>
<?php
$tabname=$_GET['tabname'];
?>
<form id="form1" name="form1" action="">
<input type="file" id="file_upload" name="file_upload" /><br />
<a href="javascript:$('#file_upload').uploadifyUpload();">Upload File</a>
</form>
</body>
</html>
请参阅该部分,$tabname 是我要在 insert.php 中使用的变量。我需要将此 $tabname 传递给 insert.php 并在其中使用它。提前致谢