I have a scenario where I need to send form data via a GET
(not a POST
). I'm submitting the form to the same page as the form is on (form action="#
).
The problem is that the controller for the site can't handle array data-- it looks for strings or json
only. So when I have any array data from a row of text boxes that gets sent, I get a 500 error.
I am currently doing something like this:
$('#submit').on("click", function(e){
e.preventDefault();
$form.serialize();
$form.submit();
})
But this doesn't get the job done. The URL params look like this:
index.php?condition%5b%5d%3dtest
How can I access the actual form data and "rewrite" the data to be a valid json
string for the text box values prior to sending the form?
I could POST
the data but then I'd need a different route, and I could send the form via ajax but that would be overkill.
Thanks
NOTE: I know how to serialize the data already, as is explained in my code sample. The problem is I want to replace the URL params in the default form submission with the newly serialized / json
-ified versions, and the suggested duplicate question does not address this.