layui给form 字段绑定返回值

浪淘沙2年前前端524
 $.ajax({
     url: "/api/feedback/readByID/" + id,
     type: "POST",
     contentType: 'application/json', // 设置请求头中的 Content-Type 为 application/json
     success: function (response) {
         var data = JSON.parse(response.data);                  

         if (response.statusCode == 200) {
         //div id
             $("#useridinfo").html(readUser(data[0].UserId));
             $("#phone").html(data[0].phone);
             $("#Content").html(data[0].Content);
             $("#CreateDate").html(data[0].CreateDate);
         
         //表单input
             // form.val('form1', {
             //     "useridinfo": data[0].UserId,
             //     "phone": data[0].Phone,
             //     "Content": data[0].Content,
             //     "CreateDate": data[0].CreateDate,
                 // "article": data[0].Reply,
             //     // "catid": data[0].catid,
             //     // "opr": data[0].opr,
             //     // "oprtime": layui.util.toDateString(data[0].oprtime, "yyyy-MM-dd"),
             //     // "bit": String(data[0].bit),
             // });
         } else {
             layer.msg("操作失败", { icon: 5 });
         }
     }
 });


相关文章

element puls select 表单验证

后端: public record OptionItem(string Label, string Value);  publi...

asp.net core razor layui 分页和url参数绑定一起

@page @model xxtsoft.Web.Entry.Pages.sysadmins.rw.rw_listModel @{     La...

layui 为CKEditor 4 赋值 经常不显示

 // 在编辑器初始化后赋值  setTimeout(function() {   CKEDITOR.instances[...

asp.net core razor element plus 使用级联选择

表单 <div class="row mb-3">      <label&nb...

asp.net code webapi layui ajax post表单数据

using System; using System.Collections.Generic; using System.Linq; using Syst...

ueditor plus粘贴图片设置

 <script src="~/ueditor/ueditor.config.js"></script>  <scri...

发表评论    

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。