码迷,mamicode.com
首页 > Web开发 > 详细

JS 操作 HTML 和 AJAX 请求后台数据

时间:2018-10-30 17:17:51      阅读:164      评论:0      收藏:0      [点我收藏+]

标签:space   插入   html   list   后台   ace   value   元素   form   

为某个元素插入值,添加属性,添加子元素

  1 <div class="col-sm-6">
  2    <select class="form-control" id="creategood_store">
  3    </select>
  4  </div>
  1  var parent = document.getElementById("creategood_store");
  2  var node = document.createElement("option");
  3  node.setAttribute("value", data.result[i].id);
  4  node.innerHTML = data.result[i].name;
  5  parent.appendChild(node);

AJAX 请求后台数据

  1   $(document).ready(function () {
  2         $.ajax({
  3             url: "/gankadc/home/newlydata/recordlist",
  4             type: "GET",
  5             dataType: "json",
  6             success: function (data) {
  7 		...
  8 	    }
  9 
 10         })
 11     });
 12 

JS 操作 HTML 和 AJAX 请求后台数据

标签:space   插入   html   list   后台   ace   value   元素   form   

原文地址:https://www.cnblogs.com/Benjious/p/9876919.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!