Buongiorno a tutti!
volevo chiedervi se esiste un modo per impedire che una funzione AJAX uploadi un immagine.
Ecco la funzione:
Come si nota nella funzione ce in mezzo anche un Progress Bar.Codice HTML:var form_data = new FormData(this); //Creates new FormData object var post_url = window.location.pathname; //get action URL of form //jQuery Ajax to Post form data $.ajax({ url : post_url, type: "POST", data : form_data, contentType: false, cache: false, processData:false, xhr: function(){ //upload Progress var xhr = $.ajaxSettings.xhr(); if (xhr.upload) { xhr.upload.addEventListener('progress' , function(event){ var percent = 0; var position = event.loaded || event.position; var total = event.total; if (event.lengthComputable) { percent = Math.ceil(position / total * 100); } //update progressbar $(progress_bar_id +" .progress-bar").css("width", + percent +"%"); $(progress_bar_id + " .status").text(percent +"%"); }, true); } return xhr; }, mimeType:"multipart/form-data" }).done(function(res){ $(my_form_id)[0].reset(); //reset form $(result_output).html(res); //output response from server submit_btn.val("Upload").prop( "disabled", false); //enable submit button once ajax is done });
Il mio scopo sarebbe quello di far "sentire" al Progress Bar l'upload che viene effetuato attraverso una funzione php presente nella stessa pagina.
Come posso fare?
Grazie infinite in anticipo!

LinkBack URL
About LinkBacks
