แสดงบทความที่มีป้ายกำกับ jQuery แสดงบทความทั้งหมด
แสดงบทความที่มีป้ายกำกับ jQuery แสดงบทความทั้งหมด

วันพฤหัสบดีที่ 17 กันยายน พ.ศ. 2558

JQuery Datetimepicker event

$('.birth_date').datetimepicker({
   pickTime:false,
   pick12HourFormat: false,
   language: 'th',
   icons: {
   time: "fa fa-clock-o",
   date: "fa fa-calendar",
   up: "fa fa-arrow-up",
   down: "fa fa-arrow-down"
  },
  format:"LL"
}).on("change.dp",function(e){
    //event here
});

วันพฤหัสบดีที่ 26 มีนาคม พ.ศ. 2558

jQuery event for dynamic content

code
$.ajax({
$('body').on('click','.some-selector',function(){
  //do something
});

$(document).on('click','.some-selector',function(){
  //do something
});

วันอังคารที่ 24 มีนาคม พ.ศ. 2558

jQuery(jsonp) + PHP

javascript code
$.ajax({
   url: "http://example.com/load_data.php",
   dataType: "jsonp",
   jsonpCallback: 'jsonCallback',
   success: function(data){
      alert("success");
   },
   error:function(){
      alert("failure");
   }
});


PHP code
header("Content-Type: application/json");
require_once "connect_db.php";
$sql = "select * from Table";

 $res = mysql_query($sql) or die(mysql_error());
 $data = array();
 while($row = mysql_fetch_array($res)){
  array_push($data,$row);
 }
 echo $_GET['callback'].'('.json_encode($data).')';

วันศุกร์ที่ 15 พฤศจิกายน พ.ศ. 2556

jQuery for dynamic content

http://stackoverflow.com/questions/15090942/jquery-on-method-not-working-on-dynamic-content

$(document.body).on('click', '.update' ,function(){  });

วันอาทิตย์ที่ 26 พฤษภาคม พ.ศ. 2556

PHP + MySQL + jQuery.tablePagination0.5 (การแบ่งหน้าข้อมูลโดยใช้ตาราง)

การแบ่งหน้าแบบง่ายโดยอาศัย plugin ที่ชื่อว่า jQuery.tablePagination0.5

ดาวน์โหลด jQuery.tablePagination0.5




จาก source ดังกล่าว จะได้ผลลัพธ์ดังนี้