[jQuery] Ajax problem - undefined error

[jQuery] Ajax problem - undefined error


Hi,
I'm new to jquery. I want to develop a upload progress bar using
jquery and PHP (i already did this
with xajax and php, but i want to use jquery this time). Does anyone
know why this doesnt work:
$(document).ready(function() {
function progress()
{
$.ajax({
type: "POST",
url: "http://URL/ajax/uploadProgress/",
data: "upload_id=" + $('#UPLOAD_IDENTIFIER').val() +
"&file=" + $('#video_file').val() + "&debug=",
cache: false,
dataType: "json",
success: function(data){alert("Data Saved: " +
data.msg );},
error: function(XMLHttpRequest, textStatus,
errorThrown) {
alert('XMLHttpRequest:
'+XMLHttpRequest);alert('textStatus: '+textStatus);alert("Error: " +
errorThrown);
}
});
}
$("#submit_video_upload").click(function(event) {
alert('start');
event.preventDefault();
var upload_id=$('#UPLOAD_IDENTIFIER').val();
var upload_file=$('#video_file').val();
$.post("http://URL/ajax/uploadProgress", { upload_id:
upload_id, file: upload_file },
function(response) {
$("#upload_status").fadeIn();
if ( response.status == 0 ) {
progress();
$("#videoUploadForm").submit();
} else {
$("#upload_status").html(response.msg);
}
}, "json");
alert('end');
});
});
On #submit_video_upload.click the ajax call is executed correctly and
a json string is received from the server,
second time (in function progress()) the ajax call doesnt work
anymore, and the error i get (errorThrown) is undefined). I also tried
with the same function (with $.post) in progress().
Any ideas?
Thanks,
Adrian.