0
我在讓我在jquery中定義的函數讀取其他地方定義的javascript值時遇到了麻煩。 比如我有我的jQuery在jQuery和其他javascript全局變量之間傳遞變量
var parentImg = ''; //global variable.
$(document).change(function() {
if ($("#parentImage option:selected").val())
parentImg = $("#parentImage option:selected").val();
alert(parentImg);
});
$(function(){
$('#swfuploadcontrol').swfupload({
upload_url: "upload-file.php?page=<?php echo $htmlFile; ?>&parentImg=" + parentImg});})
中定義的函數,但我不能讓他看我在頂部「」 parentImg「」定義一個全局變量。看起來像jQuery中定義的一切生活在自己的空間,不與外部世界互動..
任何想法如何我可以傳遞這些值來回btw jQuery和其他代碼?
如何通過「upload_url」變量傳遞「parentImg」變量值?