Javascript 将动态输入表单数据保存到数据库kendo ui中

Javascript 将动态输入表单数据保存到数据库kendo ui中,javascript,jquery,kendo-ui,asp.net-web-api2,Javascript,Jquery,Kendo Ui,Asp.net Web Api2,我已经填充了动态输入表单字段。它已成功填充。我不知道如何使用put/post api将数据保存到数据库中。就像我以前得到的api一样 html代码 请帮助我,如何使/使用ajax函数调用Post/Put将每个动态字段的数据保存/更新到数据库中。我感谢您宝贵的时间和努力,提前表示感谢。在阅读了更多文章后,我终于找到了这个解决方案。这对我有用 $("#save").on("click", function () { $("#renderform input").each(funct

我已经填充了动态输入表单字段。它已成功填充。我不知道如何使用put/post api将数据保存到数据库中。就像我以前得到的api一样

  • html代码

  • 请帮助我,如何使/使用ajax函数调用Post/Put将每个动态字段的数据保存/更新到数据库中。我感谢您宝贵的时间和努力,提前表示感谢。

    在阅读了更多文章后,我终于找到了这个解决方案。这对我有用

    $("#save").on("click", function () {
    
            $("#renderform input").each(function () {
                var dataModel = {
                    parentid: $(this).attr("id"),
                    ItemOrder: "1",
                    ItemFieldType: "1",
                    ColWidth: "100",
                    RowHeight: "100",
                    ItemText: $(this).val(),
                    ItemLabel: $(this).attr("name")
                };
                $.ajax({
                    type: 'POST',
                    url: crudServiceBaseUrl + "FormsItem?firmid=" + firmid + "&createdby=" + clientid,
                    data: JSON.stringify(dataModel),
                    contentType: 'application/json; charset=utf-8',
                    dataType: 'json'
                });
            });
            alert("Data Saved successfully");
        });
    

    在读了更多的文章后,我终于找到了这个解决方案。这对我有用

    $("#save").on("click", function () {
    
            $("#renderform input").each(function () {
                var dataModel = {
                    parentid: $(this).attr("id"),
                    ItemOrder: "1",
                    ItemFieldType: "1",
                    ColWidth: "100",
                    RowHeight: "100",
                    ItemText: $(this).val(),
                    ItemLabel: $(this).attr("name")
                };
                $.ajax({
                    type: 'POST',
                    url: crudServiceBaseUrl + "FormsItem?firmid=" + firmid + "&createdby=" + clientid,
                    data: JSON.stringify(dataModel),
                    contentType: 'application/json; charset=utf-8',
                    dataType: 'json'
                });
            });
            alert("Data Saved successfully");
        });
    
    <script type="text/javascript">
        // retrieve the model from an API call
        $.ajax({
            url: crudServiceBaseUrl + "FormItemsDesign/GetFormItemsDesignList?parentid=" + formdesignid,
            //url :"json.txt",
            type: "GET",
            dataType: "json",
            success: function (model) {
                // convert the JSON to observable object
                var viewModel = kendo.observable(model);
                // bind the model to the container
                kendo.bind($("#renderform"), viewModel);
            }
        });
    </script>
    
    url: crudServiceBaseUrl + "FormItemsDesign
    type:Post
    type:Put
    
    $("#save").on("click", function () {
    
            $("#renderform input").each(function () {
                var dataModel = {
                    parentid: $(this).attr("id"),
                    ItemOrder: "1",
                    ItemFieldType: "1",
                    ColWidth: "100",
                    RowHeight: "100",
                    ItemText: $(this).val(),
                    ItemLabel: $(this).attr("name")
                };
                $.ajax({
                    type: 'POST',
                    url: crudServiceBaseUrl + "FormsItem?firmid=" + firmid + "&createdby=" + clientid,
                    data: JSON.stringify(dataModel),
                    contentType: 'application/json; charset=utf-8',
                    dataType: 'json'
                });
            });
            alert("Data Saved successfully");
        });