Hi,

I use HTML5 and jqeury to handle files upload, but I have a problem in processing the json returns from the server (I got this jquey code and modified from the mozilla documentation site),

Code JavaScript:
function post_file_jquery(file)
    {
    	// HTML5 form data object.
    	var fd = new FormData();
 
    	// appends the currently selected File of an <input type="file" id="file"> element to an FormData instance (which is later to be sent as multipart/form-data XHR request body).
    	fd.append("file", file);
 
    	// jquery will then hanle the data.
    	$.ajax({
    		url: "upload.php",
    		type: "POST",
    		data: fd,
    		processData: false,  // tell jQuery not to process the data
    		contentType: false,   // tell jQuery not to set contentType
    		dataType: "json",
    		success: process_json
    	});
    }

an example of json data from the sever,

HTML Code:
 [{"success":true,"filename":"agard.jpg"}]
the part that processes the json object,

Code JavaScript:
 function process_json(data) { 
 
    	// 'data' is the json object returned from the server 
    	$.each(data, function(i, item) {
    		//alert(data[i].filename); or:
    		alert(item.filename);
    	});
 
    	$.each(data, function(i, item) {
    		//alert(data[i].success);
    	});
 
    	$.each(data, function(i, item) {
    		//alert(data[i].error);
    	});
    	//alert(data[0].filename); 
    }

But I do not get any alert at all - what can I do to get the result?

Why do these two lines have to set to false? Do I have to keep them?

Code JavaScript:
 processData: false,  // tell jQuery not to process the data
    contentType: false,   // tell jQuery not to set contentType

Thanks,
Lau