Reputation: 9037
I created a ajax function for uploading file images, everything works except there's an ugly part where the page freezed at the process (ajax file image processing submission), any ideas, help, suggestions, clues? below is my code reference.
$("#form_image_file_submit").submit(function(e){
var this_current = $(this);
var formData = new FormData(this_current[0]);
$.ajax({
url : this_current.attr("action"),
data: formData,
type: 'post',
cache: false,
async: false,
complete: function(data){
alert(data);
}
});
Upvotes: 0
Views: 244
Reputation: 3847
Use async:true
or remove it.
async (default: true) Type: Boolean By default, all requests are sent asynchronously (i.e. this is set to true by default). If you need synchronous requests, set this option to false. Cross-domain requests and dataType: "jsonp" requests do not support synchronous operation. Note that synchronous requests may temporarily lock the browser, disabling any actions while the request is active. As of jQuery 1.8, the use of async: false with jqXHR ($.Deferred) is deprecated; you must use the success/error/complete callback options instead of the corresponding methods of the jqXHR object such as jqXHR.done() or the deprecated jqXHR.success().
Upvotes: 1