0

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?

Alex Manea
  • 104
  • 6
  • [$(this).serialize() -- How to add a value?](https://stackoverflow.com/questions/6539502/this-serialize-how-to-add-a-value) .. And .. [JQuery - Appending to Serialize](https://stackoverflow.com/questions/8289349/jquery-appending-to-serialize/8289405) – Mohamed-Yousef Mar 25 '22 at 15:36

0 Answers0