使用html表单将数据发布到restapi

时间:2018-06-07 12:28:42

标签: javascript html

  <form action="">
          <table class="table borderless" >
              <tr>
                  <th>Title Identifier</th>
              </tr>
              <tr>
                  <td style="border:none">
                      <b>Product ID :</b>

                  </br>
                  <input type="text"  style = "color:black"></td>
                    <td style="border:none"></td>
                  <td style="border:none">
                      <b>Product Title :</b>

                   <br><input type="text" style = "color:black"></td>
              </tr>

              <tr>
                  <td style="border:none">
                    <br>  <b>Terrritory :</b>
                     <br> <input type="text" style = "color:black">
                  </td>
                  <td style="border:none"></td>
                  <td style="border:none">
                    <b>Media :</b>
                    <br>  <input type="text" style = "color:black">
                  </td>
              </tr>
              <tr>
                  <td style="border:none">
                      <b>Language :</b>
                     <br> <input type="text" style = "color:black">
                  </td>
                  <td style="border:none"></td>
                  <td style="border:none">
                      <b>Format :</b>
                      <br><input type="text" style = "color:black">
                  </td>
              </tr>
              <tr>
                  <td style="border:none">
                    <b>  <p >Start Date : </p></b>
                      <input type="date" style = "color:black;">
                  </td>
                  <td style="border:none"></td>
                  <td style="border:none">
                      <b>End Date :</b>
                      <br><input type="date" style = "color:black;">
                  </td>
              </tr>
              <tr>
                  <td style="border:none">
                      <b>Exclusivity :</b>
                      <select name="" id="">
                          <option value="yes" style = "color:black;">Yes  </option>
                          <option value="no" style = "color:black">No</option>
                      </select>
                  </td>
                  <td style="border:none"></td>

              </tr>
              <tr>
                  <td style="border:none">
                      <b>Acquiring Division :</b>
                      <br><input type="text" style = "color:black">
                  </td>
                  <td style="border:none"></td>
                  <td style="border:none">
                      <b>Owner :</b>
                      <br><input type="text" style = "color:black">
                  </td>
              </tr>
              <tr>
                  <td style="border:none"></td>
                  <td style="border:none"  class="pull-right">

                  </tr>

                </table>

                <form action="" method = "POST" name = "myform" >
                  <button  type="submit" value  =" submit" onclick="submitform()" style = "color:Red;">submit</submit>
                   <button type="reset" value="Reset"  onclick ="reset()"  style = "color:Red;" >Reset</button>
                 </form>

我有以下字段我遇到了一些错误

*

  

*无法查找视图&#34;模板/错误&#34;在ServerResponse.render的EventEmitter.render的views目录中   Layer.handle_error       trim_prefix       Function.process_params **

但是当我们解析邮递员中的数据时,api正常工作

 {"productID":"1014",
"title":"Movie1",
"startDate":"20-05-2018",
"endDate":"20-05-2019",
"excl":"yes",
"territory":"Asia",
"media":"Sony",
"language":"English",
"format":"mp4",
"acquiringDivision":"Sony",
"owner":"MCU"
} 

如何将表单数据转换为json并解析为api

0 个答案:

没有答案