Reputation: 111
How to pass form data from HTML(.html) to Web service(c#) and then registers this in a database, it's possible?
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<meta charset="utf-8" />
</head>
<body>
<form id="form1" method="post" action="#">
<div>
<div>
<input id="Text1" type="text" name="username"/>
</div>
<div>
<input id="Text2" type="text" name="password" />
</div>
<div>
<input id="Button1" type="button" name="enviar" value="Enviar" />
</div>
</div>
</form>
</body>
</html>
Upvotes: 1
Views: 1391
Reputation: 4945
Replace <form id="form1" method="post" action="#">
To <form id="form1" method="post" action="/REST_URL/OF_YOUR_CHOICE">
It will be application/x-www-form-urlencoded
not json
But you don't need json here.
In your web service (assuming you are using asp.net) you need
EDIT
If you have not already done You may need to put this in web.config
<system.web>
<webServices>
<protocols>
<add name="HttpPost"/>
</protocols>
</webServices>
</system.web>
Upvotes: 1