I have form with inputs in html.
Then I added this javascript (jquery) stroke to read and collect all value or data from form.
var formData = $("#form").serialize();
When I
console.log(formData);
Output will show:
calc-ownership=ooo&calc-activity=restaurant&calc-tax=usn&calc-tax-2=charge&calc-bank=partners&calc-who-payments=client&operations_count=0&calc-nomenclature=slim&documents_count=0&calc-who-docs=client&staff_count=0&calc-more%5B%5D=patent&calc-more%5B%5D=alcohol&period=&price=&price_sber=&rate-name=&email-to=
Then I found function in jquery called post
$.post(path, formData, success, "json");
Request look like:
do.php?bank=partners
As you see it makes post request to my do.php
.
Now how I can read this query and work with this data?
I found analog to $.post
in jquery. It is $.ajax
Full code:
$.ajax({ url: path, method: "POST", data: {formData: formData} });
It works well.
But I want to work with $.post
I am looking at my url at the moment. And it looks : https://stackoverflow.com?ask=32321
I need something similar to read my query from javascript this url with php
See Question&Answers more detail:os