js ajax payload,javascript - ajax returns payload instead of form data - Stack Overflow

I return a payload instead of a form data and I can not retrieve the values ​​with php

I need a post type formdata but I can not figure out how to

$('#send_avatar').click(function(){

var x=document.getElementById("x").value;

var y=document.getElementById("y").value;

var w=document.getElementById("w").value;

var h=document.getElementById("h").value;

var fd = new FormData();

//fd = 'x=' + x + '&y=' + y + '&w=' + w + '&h=' + h ;

fd.append('file', $('#uploadImage')[0].files[0]);

fd.append('x', x);

fd.append('y', y);

fd.append('w', w);

fd.append('h', h);

$(".ris").html("loading.gif");

//dataString.append("image", immagine);

$.ajax({

type: "POST",

url: "funzioni/upload_avatar.php",

data: fd,

async: false,

cache: false,

contentType: "X-Requested-With:XMLHttpRequest",

processData: false,

success: function(response){

$(".ris").html(response);

}

});

});

How can I do it?

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值