Good afternoon everyone. I'm starting with Swagger and I have a problem that I
can not solve.
I am creating a form that collects a registry data, stores it in a variable as
a JSON object and then sends it to a database to store.
The problem is that the data is inserted empty into the database it.
$v1 = $('#name').val();
$v2 = $('#mail').val();
$v3 = $('#tlf').val();
$v4 = $(':selected').val();
$dat ={
"name": $v1,
"mail": $v2,
"tlf": $v3,
"product": $v4
};
var xmlhttp = new XMLHttpRequest();
xmlhttp.open("POST", $sending, false);
xmlhttp.setRequestHeader("accept" ,"application/json");
xmlhttp.setRequestHeader("content-type" ,"application/json");
alert(JSON.stringify($datos)); <-- Here you print the values to be
inserted and it seems all correct
xmlhttp.send(JSON.stringify($datos));
alert(xmlhttp.response); <-- Here you are shown the answer and all the
empty fields are shown
I would greatly appreciate a help since I have no idea that it may be failing.
Forgive possible syntactic errors. I used the Google translator to write this
text.
--
You received this message because you are subscribed to the Google Groups
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.