와 현재 데이터를 전달 나는 이미지를 업로드하는 데 사용하는 양식이ajaxform
var statustxt = $('#statustxt');
var submitbutton = $("#SubmitButton");
var myform = $("#UploadForm");
var galleryStatus2$ = $("#galleryStatus2");
var error_code;
$(myform).ajaxForm({ // called when the code loads
data : {dstDir : g.currentGal}, // pass in some $_POST parameters
resetForm : true,
beforeSend: function() { //before submitting the form
galleryStatus2$.empty(); // clear status from last upload
submitbutton.attr('disabled', ''); // disable upload button
$('img#loadGif').fadeIn(200); // start spinner
},
complete: function(response) { // upload complete
console.log("<br />upload complete. g.currentGal = " + g.currentGal);
galleryStatus2$.html(response.responseText); //upload status
submitbutton.removeAttr('disabled'); //enable submit button again
$('img#loadGif').fadeOut(200); // kill spinner
제가하는 데 문제는 내가 원하는 것입니다 액션 스크립트 uploadImage.php에 업로드 할 디렉토리를 알릴 수 있어야합니다. 나는 이것을 "data : {dstDir : g.gurrentGal}"라인으로 시도한다. g.currentGal은 마지막으로 더블 클릭 된 폴더, 즉 마지막으로 열렸던 폴더를 저장하므로 업로드 할 대상이됩니다. 그러나 양식이 제출 될 때가 아니라 코드가 처음로드 될 때 ajaxform 코드가 실행됩니다. 따라서 g.currentGal은 JavaScript가 처음으로로드 될 때 변수가 초기화 된 이후의 마지막 폴더는 절대로 초기화되지 않습니다. $ _POST 배열의 uploadImage.php로 양식이 제출 될 때 g.currrentGal의 가치를 얻으려면 어떻게해야합니까?
감사합니다.