Commit 27bf0ff0 by opal007

Merge branch 'integration' into opal007

parents 48ca970a d68b3251
......@@ -24,7 +24,8 @@ class ProfilesController extends AppController
$this->loadModel('MasterCountries');
$Country = $this->MasterCountries->find('list', [
'conditions' => [
'is_used' => true],
'is_used' => true,
'MasterCountries.id' => 1],
'keyField' => 'id',
'valueField' => 'country_name_th'
]);
......@@ -34,7 +35,8 @@ class ProfilesController extends AppController
$this->loadModel('MasterProvinces');
$Province = $this->MasterProvinces->find('list', [
'conditions' => [
'is_used' => true],
'is_used' => true,
'master_country_id' => 1],
'keyField' => 'id',
'valueField' => 'province_name_th'
]);
......@@ -566,4 +568,29 @@ if (!empty($SubjectEnrolls)) {
}
// public function getProvince() {
// $this->autoRender = false;
// $this->loadModel('MasterProvinces');
// $states = array();
// // pr($this->request->data);die;
// // echo 'jjjj';
// $states = $this->MasterProvinces->find('list', array(
// 'keyField' => 'id',
// 'valueField' => 'province_name_th',
// 'conditions' => array(
// 'master_country_id' => 2
// )
// ))->toArray();
// $arr = array();
// foreach($states as $key => $val){
// $arr[$key] = $val;
// }
// //pr($states);die;
// // $arr['1'] = "ไทยยยย";
// // $arr['2'] = "ไทยยยยยยยยยย";
// echo json_encode($arr);
// // $data = jQuery.parseJSON($f);
// // pr($data);die;
// }
}
......@@ -200,29 +200,25 @@
//==================================================
// CHANGE Province According Country
//==================================================
$(document).ready(function() {
$("#loding1").hide();
$("#loding2").hide();
$("#master_country_id").on('change',function() {
var id = $(this).val();
$("#loding1").show();
$("#master_province_id").find('option').remove();
if (id) {
var dataString = 'id='+ id;
$.ajax({
type: "POST",
url: '/Profiles/index',
data: dataString,
cache: false,
success: function(html) {
$("#loding1").hide();
$.each(html, function(key, value) {
$('<option>').val('').text('select');
$('<option>').val(key).text(value).appendTo($("#master_province_id"));
});
}
});
}
});
});
// $(document).ready(function() {
// $("#loding1").hide();
// $("#loding2").hide();
// $("#master_country_id").on('change',function() {
// var id = $(this).val();
// // alert('dddd');
// $("#loding1").show();
// $("#master_province_id").find('option').remove();
// if (id) {
// var dataString = 'id='+ id;
// alert(dataString);
// $.post("/Profiles/getProvince", {id: id}, function(data) {
// console.log(data);
// data = jQuery.parseJSON(data);
// console.log(data);
// });
// // $('<option>').val('').text('---Select---');
// // $('<option>').val(key).text(value).appendTo($("#master_province_id"));
// }
// });
// });
</script>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment