I have this form:
<form action="#" method="post" id="cen" runat="server">
<table>
<thead>
<tr>
<th>Contacto</th>
<th>Fecha</th>
<th>Hora</th>
<th >Mensaje</th>
</tr>
</thead>
<tbody>
<tr>
<td><input name="user[]" id="correo" type="email" placeholder="[email protected]" style="width: 10em;"></td>
<td><input name="date[]" id="fecha" type="date" data-role="datebox" data-options='{"mode": "calbox"}'></td>
<td><input name="hour[]" id="hora" type="text" data-role="datebox" data-options='{"mode": "timebox", "overrideTimeFormat": 12}'></td>
<td><textarea name="mensaje[]" id="mensaje" placeholder="Su mensaje Aqui" style="width: 15em; max-width: 15em;"></textarea></td>
</tr>
</tbody>
<tfoot>
<tr>
<td><input type="submit" value="Enviar" /></td>
</tr>
</tfoot>
</table>
</form>
I have a button to clone that form, so the user can send an array of elements.
My question: how do I send that array to a Web service with JQuery? I have this for the moment:
<script>
$("form").submit(function (event) {
event.preventDefault();
var result = new XMLHttpRequest;
var URL = "checkMessage.ashx?sendTo=" + $('#correo').val() + "&dateIn=" + $('#fecha').val() + "&hourIn=" + $('#hora').val() + "&messageIn=" + $('#mensaje');
result.open("GET", URL, false);
result.send;
var resultString = JSON.parse(result.responseText);
// var resultString = JSON.parse(result.responseText);
if (resultString.respuesta == 1)
{
alert("Su mensaje fue enviado");
}
})
</script>
But the web service doesn't receive anything.
For the moment in my web service I just have these:
public void ProcessRequest (HttpContext context) {
string[] destinatario;
string respuesta;
respuesta = context.Request.QueryString["sendTo"];}
Because I making test.
This is the first time I'm working with web service.
My problem is, that I can't consume the web service, and I don't know wy