Php 发送formData时,发送前的ajax不起作用

Php 发送formData时,发送前的ajax不起作用,php,jquery,ajax,Php,Jquery,Ajax,我要去潜水 它在发送ajax请求时显示加载程序映像 我在ajax的beforeSend属性中附加了div。问题是如果我发送serialize()数据,那么beforeSend可以工作,但在发送formData时不工作 工作 不起作用 $.ajax({ url: 'centre-upload-process.php', type: 'POST', data: formData, async: false, beforeSend: function() {

我要去潜水

它在发送ajax请求时显示加载程序映像

我在ajax的beforeSend属性中附加了div。问题是如果我发送serialize()数据,那么beforeSend可以工作,但在发送formData时不工作

工作

不起作用

$.ajax({
    url: 'centre-upload-process.php',
    type: 'POST',
    data: formData,
    async: false,
    beforeSend: function() {
        $('.displayLoader').show();
    },
    success: function(response) {
        alert("You have succesfully submitted the form. Please complete the payment method");
        document.location.href = "dashboard.php";
    },
    cache: false,
    contentType: false,
    processData: false
});

我甚至试过
ajaxStart()
,但遇到了同样的问题。有人能帮我吗?

您使用哪个版本的Jquery?@ShadyAtef jquery1.9。1@PrateekVermaformData包含图像..在后端使用PHP处理。您可以在诸如@ShadyAtef这样的网站上放置一个实例吗?@ShadyAtef我该如何做…在后端使用PHP处理表单您使用的Jquery的哪个版本?@ShadyAtef jquery1.9。1@PrateekVerma formData包含图像..在后端使用PHP处理。您可以在诸如@ShadyAtef之类的网站上放置一个实时示例吗?@ShadyAtef我该如何做…表单在后端使用PHP处理
$.ajax({
    url: 'centre-upload-process.php',
    type: 'POST',
    data: formData,
    async: false,
    beforeSend: function() {
        $('.displayLoader').show();
    },
    success: function(response) {
        alert("You have succesfully submitted the form. Please complete the payment method");
        document.location.href = "dashboard.php";
    },
    cache: false,
    contentType: false,
    processData: false
});