title: How to submit data using knockout.. and I have below form like this
body: <p>How to submit data using knockout in mvc4
  and  I have created a form with employee id, employee name, designation and department is selected based in drop down that code is already working fine but I was strucked while while submiting only .</p>
  
  <p>but how should i get textbox values to viewmodel and bind it to data property?</p>
  
  <pre><code>&lt;div id="div1"&gt;
      &lt;table align="center"&gt; 
          &lt;tr&gt;
              &lt;td&gt;enter code here
                  Employee Id:
              &lt;/td&gt;
              &lt;td&gt;enter code here
                  &lt;input data-bind="value:EmpId" type="text" id="txtempid"/&gt; 
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;
                  Name:
              &lt;/td&gt;
              &lt;td&gt;&lt;input data-bind="value:EmpName" type="text" id="txtempname"/&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;
                  Designation:
              &lt;/td&gt;
              &lt;td&gt;&lt;input data-bind="value:Designation" type="text" id="txtdesignation"/&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;
                   Department Name:
              &lt;/td&gt;
              &lt;td&gt; 
                  &lt;select id="CategoryType" style="width: 250px; height: 25px; margin-top:10px;" data-bind="optionsText:'deptname', value:deptid"&gt;&lt;/select&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td align="right" colspan="2"&gt;
                  &lt;input type="submit" value="Save" id="btnSave" name="btnSave" /&gt;
                      &amp;nbsp
                      &lt;input type="submit" value="Cancel" id="btnCancel" name="btnCancel" /&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
      &lt;/table&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>And I tried like below using knockout  but getting  an error..</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      $('#btnSave').live("click", function (e) {
          var viewModel = {
           this.EmpId: ko.observable(""),
           this.EmpName: ko.observable(""),
           this.Designation: ko.observable(""), 
           this.deptid:ko.observable("")
          };
          ko.applyBindings(viewmodel);
          $.ajax({
              url: '/Home/Save/',
              async: true,
              cache: false,
              type: 'post',
              data: ko.toJSON(viewmodel),
              contentType: 'application/json',
              success: function (result) {
              $("lblResult").val("Recorded inserted Sucessfully");
                  $("txtempid").text("");
                  $("txtdeptid").text("");
                  $("txtempname").text("");
                  $("txtdesignation").text("");
              }
          });
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>Can any one suggest answer please   ........  for submitting this data to controller and then I will save it to database.</p>