'Ajax overwrite serialized data
I want to overwrite a serialized json array from a form, and for every user input in the json array I want to transform the user input : from this
{
incident: [ '112', '911' ],
//...
to this one :
{
incident: [ 'predifinedtex112', 'predifinedtex911' ],
/...
I use ajax for trying this one, but is not working:
$(document).ready(function() {
if ($("#formid").length) {
$("#formid").submit(function(event) {
var form = $(this);
var formData = new FormData(form);
formData.append('incident', 'www.google.com')
var url = form.attr('action');
$.ajax({
type: "POST",
url: url,
data: formData.serialize(),
//other code...
How can I pre process this before sending the form?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|