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

Jquery getJson

时间:2014-08-19 12:50:34      阅读:191      评论:0      收藏:0      [点我收藏+]

标签:io   ar   cti   log   ad   on   sp   res   

//js

function get_addressinfo(x){
  var zipcode = $("#"+x+"_zipcode").val();
  $.getJSON("ebanx/zipcode", {zipcode: zipcode}, function(msg){
      if(msg[‘status‘] == ‘SUCCESS‘){
        var addressinfo = msg[‘zipcode‘];
        $("#"+x+"_state").val(addressinfo[‘state‘]);
        $("#"+x+"_city").val(addressinfo[‘city‘]);
        $("#"+x+"_address").val(addressinfo[‘address‘]);
    }else{
      alert(‘invaled zipcode, please enter again‘);
    }
  });
}

 

 

//application/control/ebanx/zipcode

public function zipcode(){
    $url = $this->url.‘zipcode‘;
    $zipcode = $_GET[‘zipcode‘];
    $res_merch = $this->pay_order->get_method_info_by_class_name(‘ebanx‘);

    $res = $this->pay_order->get_merchant_data_by_pay_type($res_merch[0][‘pay_type_id‘], $res_merch[0][‘method_id‘]);

    $params = array(
        ‘integration_key‘ => $res[0]->merchant_key,
        ‘zipcode‘ => $zipcode);

      log_message(‘gash‘, ‘zipcode parameters: ‘.json_encode($params));

      $query_res = $this->_makeRequest($url, $params, ‘get‘);
      $result_array = json_decode($query_res[‘msg‘], TRUE);
      log_message(‘gash‘, ‘zipcode result: ‘.json_encode($result_array));
      echo json_encode($result_array);
}

Jquery getJson,布布扣,bubuko.com

Jquery getJson

标签:io   ar   cti   log   ad   on   sp   res   

原文地址:http://www.cnblogs.com/barfoo/p/3921754.html

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