I would like to get a json result from my input fields.
Json Result
[{ScheduledVisit: "09/06/2017 12:00 AM", Company: "ABC Corp.", ContactPerson: "Someone"}]
The reason for that is because I want it to fit my class of
public class ScheduleVisit
{
[Required(ErrorMessage = "* Required")]
public DateTime ScheduledVisit { get; set; }
public string Company { get; set; }
public string ContactPerson{ get; set; }
}
I do not want to use the $("inputForm").serialize(); because I want to learn how to do this manually.
Below is my input form
<div class="col_half">
<input type="text" name="ScheduledVisit" placeholder="Scheduled Visit" class="sm-form-control border-form-control datetimepicker" id="ScheduledVisit" />
</div>
<div class="col_half col_last">
<input type="text" name="company" class="sm-form-control border-form-control" placeholder="company" id="company" />
</div>
<div class="col_two_third">
<input type="text" name="contactPerson" placeholder="Contact Person" class="sm-form-control border-form-control" id="contact" />
</div>
Please help. Thank you.
JSONfrom<input>.nameand.values, or is requirement to create a JavaScript object?