日期:2014-05-18  浏览次数:20410 次

Jquery Ajax 数据保存至数据库的问题,急求高手赐教!!不好意思,新手分不多
<script type="text/javascript">
  $(document).ready(function () {
  $.baseball({
  accepter: "#lefts,#centers,#rights",
  target: ".baseball",
  handle: ".basebat"
  })
  //页面加载读取数据库中保存的布局数据
  var hei = $(window).height();
  var wid = $(window).width();
  $("#LoadDiv").css({ left: wid / 2 ,top:hei/2}).hide();
// $("#LoadDiv").css({ top: hei / 2 });
// $("#LoadDiv").hide();
  $.ajax({
  url: "Second.aspx", //提交页面
  data: null,
  dataType: "json",
  type: "post",
  beforeSend: function () {
  $("#LoadDiv").show();
  },
  complete: function () {
  $("#LoadDiv").hide();
  },
  success: function (data) {
  $.each(data.root, function (idx, item) {
  if (idx == 0) {
  return true; //同countinue,返回false同break 
  } else {
  var DivId = item.DivId; //得到数据库中DIV的的ID
  var DivWidth = item.DivWidth; //DIV的宽
  var DivHeight = item.DivHeight; //DIV的高
  var leftPosition = item.leftPosition; //DIV的左边距
  var topPosition = item.topPosition; //DIV的右边距
  var DivParentId = item.DivParentId; //DIV父元素的ID
  var DivIds;
  var DivParentIds;
  if (DivId == "div1") {
  DivIds = $("#div1");
  } else if (DivId == "div2") {
  DivIds = $("#div2");
  } else if (DivId == "div3") {
  DivIds = $("#div3");
  } else if (DivId == "div4") {
  DivIds = $("#div4");
  } else if (DivId == "div5") {
  DivIds = $("#div5");
  } else if (DivId == "div6") {
  DivIds = $("#div6");
  } else if (DivId == "div7") {
  DivIds = $("#div7");
  } else if (DivId == "div8") {
  DivIds = $("#div8");
  } else if (DivId == "div9") {
  DivIds = $("#div9");
  } else if (DivId == "div10") {
  DivIds = $("#div10");
  }
  if (DivParentId == "lefts") {
  DivParentIds = $("#lefts");
  } else if (DivParentId == "rights")