zoukankan      html  css  js  c++  java
  • 数据交互 ajax 初始化省

     1 //初始化省
     2 function initProvince() {
     3     if( areaLvel == 0 ) {
     4         return;
     5     }
     6     // 清空option
     7     $("#select_province").html('');
     8     
     9     $.ajax({
    10         type: 'GET',
    11         url: '/path/to/file',
    12         dataType: 'json',
    13         contentType: "application/json;charset='UTF-8'",
    14         data: {
    15             areaLvel: areaLvel 
    16         },
    17         cache: false,
    18         success: function (data) {
    19             if( data.code == 0 ){
    20                 // 系统异常
    21                 
    22             } else if (data.code == 1) {
    23                 // 添加option
    24                 $("#select_province").append($("<option/>").val(0).text("请选择省市"));
    25                 if( data.data != null ) {
    26                     $.each(function(i, item) {
    27                         $("#select_city").append($("<option/>").val(item.code).text(item.name));
    28 
    29                     });
    30                 }
    31             } else if (data.code == -1) {
    32                 // 未登录
    33                 index();
    34             } 
    35         } // success end
    36 
    37     }) // ajax end
    38 }
     
    

      

  • 相关阅读:
    epplus
    http://www.cmake.org/
    patheditor2
    emgu cv
    OpenCV
    Tesseract
    Blendar基金会
    安装服务windows,installutil
    R 软件
    历史为什么选择C语言?事实证明:暮年的C语言,依旧宝刀未老!
  • 原文地址:https://www.cnblogs.com/zsongs/p/5996118.html
Copyright © 2011-2022 走看看