zoukankan      html  css  js  c++  java
  • js 小结

    <script type="text/javascript">
    var hotalAddJs = {
    makeSubmitDataHandler: function () {
    var HotelName = $("#HotelName").val();
    var Area = $("#Area").val();
    var Address = $("#Address").val();
    var Mobile = $("#Mobile").val();
    var Type = $("#Type").val();
    var Price = $("#Price").val();
    var Description = $("#Description").val();
    var HI_HotalImages = [];
    $("li", "ul.ulImageContainer").each(function (index, entity) {
    if ($(":hidden", entity).length > 0) {
    HI_HotalImages.push({ ImageName: $("img", entity).attr("alt"), ImageUrl: $(":hidden", entity).val(), IsPrimary: $(":radio:checked", entity).length > 0 });
    }
    });
    var submitData = {
    HotelName: HotelName,
    Area: Area,
    Address: Address,
    Mobile: Mobile,
    Type: Type,
    Price: Price,
    Description: Description,
    HI_HotalImages: HI_HotalImages
    };
    return submitData;
    }
    };
    $(function () {
    $(".link_upload_delete").live('click', function () {
    $(this).parent().parent("li").fadeOut('normal').remove();
    });
    $("form:first").validate();
    $(":submit").click(function () {
    if ($("form:first").valid()) {
    $.ajax({
    url: $("form:first").attr("action"),
    type: 'POST',
    dataType: 'json',
    contentType: 'application/json;charset=utf-8;',
    data: JSON.stringify(hotalAddJs.makeSubmitDataHandler()),
    beforeSend: function () {
    $(":submit").attr("disabled", "disabled");
    },
    success: function (data) {
    if (data) {
    window.location.href = '@Url.Action("HotalIndex")';
    return false;
    }
    },
    complete: function () {
    $(":submit").removeAttr("disabled");
    }
    });
    }
    return false;
    });
    });
    </script>
    <script type="text/javascript">
    $(function () {
    var settings = {
    eventTarget: $("#upload_button"),
    action: '@Url.Action("UploadImage", "Care")',
    regExp: /^(jpg|png|jpeg|gif|bmp)$/,
    onComplete: function (fileInfo) {
    if (fileInfo.isSuccess) {
    $("<span><input type='hidden' value='" + fileInfo.fileUrl + "'><img src='" + fileInfo.filePath + "' alt='" + fileInfo.fileName + "' width='100' height='150'/><br/><a class='button link_upload_delete' href='javascript:void(0)'>删除</a><label><input type='radio' name='imagePrimaryGroup'/>是否主图</label></span>").wrapAll("<li style='float:left;list-style-type:none;'></li>").parent().appendTo($(".ulImageContainer")).hide().fadeIn('normal');
    }
    else {
    $.messager.alert('Warning', fileInfo.msg);
    }
    }
    };
    new AjaxUploadSetting(settings);
    });
    </script>

  • 相关阅读:
    阿里巴巴面试题集合
    mysql的面试试题
    taobao面试要点
    properties文件value换行处理方式
    nginx添加需要代理的域名 配置
    spark基本概念
    MySQL半同步Semi-sync原理介绍【图说】
    J_D 仓储所用mysql版本
    mysql数据库的物理文件结构
    判断浏览器
  • 原文地址:https://www.cnblogs.com/TddCoding/p/3143318.html
Copyright © 2011-2022 走看看