一切正常,但uploadifyUpload()函数似乎没有触发。它不会访问add_list.php脚本。
以下是我标题中的代码..
$(document).ready(function() {
$('#sampleFile').uploadify({
'uploader': 'include/uploadify/uploadify.swf',
'script': 'add_list.php',
'scriptData': {'mode': 'upload', 'page_title': '', 'list_title': '', 'list_columns': '', 'list_records': '', 'list_price': '', 'payment_url': '', 'list_desc': ''},
'fileDataName': 'sampleFile',
'folder': '/work/avais/lists',
'cancelImg': 'include/uploadify/cancel.png',
'queueID': 'sampleQueue'
});
$("#add_list").submit(function(){
var $upload = $("#sampleFile");
$upload.uploadifySettings('scriptData', { 'page_title': $('#page_title').val() });
$upload.uploadifySettings('scriptData', { 'list_title': $('#list_title').val() });
$upload.uploadifySettings('scriptData', { 'list_columns': $('#list_columns').val() });
$upload.uploadifySettings('scriptData', { 'list_records': $('#list_records').val() });
$upload.uploadifySettings('scriptData', { 'list_price': $('#list_price').val() });
$upload.uploadifySettings('scriptData', { 'payment_url': $('#payment_url').val() });
$upload.uploadifySettings('scriptData', { 'list_desc': $('#list_desc').val() });
/***** Error Check *****/
// Set params
var params = "page_title=" + $('#page_title').val() + "&list_title=" + $('#list_title').val() + "&list_columns=" + $('#list_columns').val() + "&list_records=" + $('#list_records').val() + "&list_price=" + $('#list_price').val() + "&payment_url=" + $('#payment_url').val() + "&list_desc=" + $('#list_desc').val();
// Send ajax request off
errorCheck('error_check.php', params, (function(ajaxResponse) {
if (ajaxResponse == 'false') {
alert('Correct');
$("#sampleFile").uploadifyUpload(); // Triggers the upload to start.
} else {
alert(ajaxResponse);
}
}));
});
});
它正确地显示了一个带有“正确”的警告框,所以我知道它正在运行它,但它只是没有运行。
如果感兴趣的话,这是errorCheck()函数..
function errorCheck(url, params, callback) {
// Create AJAX object
var myAJAX = createAJAXobject();
// Retrieve data
myAJAX.open("post",url,true);
// Send the proper header information along with the request
myAJAX.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
myAJAX.setRequestHeader("Content-length", params.length);
myAJAX.setRequestHeader("Connection", "close");
myAJAX.onreadystatechange = function() {
// Was it a success?
if (myAJAX.readyState < 4) {
return false;
}
// Set results
var res = myAJAX.responseText;
/* Returns results */
// Run the callback function
try {
callback(res);
} catch (e) {
return false;
}
}
myAJAX.send(params);
}
答案 0 :(得分:0)
好的....请不要理会。我是个白痴......我没有选择要上传的文件..我太忙于填写所有其他领域&amp;只是忘了选择文件LMAO