construct formdata manually
This commit is contained in:
parent
b3d65dc5b9
commit
54c0821339
@ -105,8 +105,21 @@ onready(function() {
|
|||||||
elem.innerHTML += ".";
|
elem.innerHTML += ".";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
var data = new FormData();
|
||||||
|
data.append("message", document.getElementById("comment").value);
|
||||||
|
var inputs = form.getElementsByTagName("input");
|
||||||
|
for(var input : inputs)
|
||||||
|
{
|
||||||
|
if(input.files)
|
||||||
|
{
|
||||||
|
for (var file : input.files)
|
||||||
|
data.append(input.name, file, file.name);
|
||||||
|
}
|
||||||
|
else if(input.name)
|
||||||
|
data.append(input.name, input.value);
|
||||||
|
}
|
||||||
ajax.open(form.method, form.action+"/json");
|
ajax.open(form.method, form.action+"/json");
|
||||||
ajax.send(new FormData(form));
|
ajax.send(data);
|
||||||
};
|
};
|
||||||
var elems = document.getElementsByClassName("postbutton");
|
var elems = document.getElementsByClassName("postbutton");
|
||||||
if(elems && elems.length > 0 && elems[0]) {
|
if(elems && elems.length > 0 && elems[0]) {
|
||||||
|
Reference in New Issue
Block a user