Kamis, 27 Februari 2020

Show Code on Blogger Blog Post

this tutorial based on post : https://stackoverflow.com/questions/1644201/how-can-i-display-code-better-on-my-blogger-blog


Click on "Edit HTML" in Blogger and then insert the following in the <head> section of your HTML:
<script src="http://alexgorbatchev.com/pub/sh/2.1.364/scripts/shCore.js" type="text/javascript"></script>
<script src="http://alexgorbatchev.com/pub/sh/2.1.364/scripts/shBrushRuby.js" type="text/javascript"></script> <script src="http://alexgorbatchev.com/pub/sh/2.1.364/scripts/shLegacy.js" type="text/javascript"></script>
<link href="http://alexgorbatchev.com/pub/sh/2.1.364/styles/shCore.css" rel="stylesheet" type="text/css"></link>
<link href="http://alexgorbatchev.com/pub/sh/2.1.364/styles/shThemeDefault.css" rel="stylesheet" type="text/css"></link>     <script language="javascript">
window.onload = function () {
    dp.SyntaxHighlighter.ClipboardSwf = 'http://alexgorbatchev.com/pub/sh/2.1.364/scripts/clipboard.swf';
    dp.SyntaxHighlighter.HighlightAll('code');
    dp.SyntaxHighlighter.BloggerMode();
}
</script>


and the following into the <body> wherever you want to put your code:

<pre class="brush: ruby" name="code"># Your Ruby Code</pre>

Rabu, 26 Februari 2020

Javascript JSON and ParseJson

JSON result
echo '{"srt":"'.$rw->idx.'","nosur" : "'.$rw->nosur.'","kode": "'.$rw->kode.'", "cetak" : "'.$rw->cetak.'", "url" : "'.$rw->url.'"}';

Parse It

$.get("?ajax=../cetak/print2&cetak=" + srt,function(response){
        if(response!=""){
            var json=$.parseJSON(response);
            $('#printmodal').modal();                   
            fmcetak=document.forms['fmcetak'];
            fmcetak.action='.?ajax='+loader+'&srt='+srt+'&src='+src;
            fmcetak['nosur'].value=json['nosur'];
            fmcetak.submit();
        }
});

Rabu, 19 Februari 2020

Post To Fill Select (ajax jquery)


  <select name="golongan" id="golongan"> <option value=''>--Pilih Golongan--</option> <? $golongan=$db->query("select * from des_kib_kode where bidang='*'"); while($rw=mysqli_fetch_object($golongan)){ echo "<option value='$rw->golongan'>$rw->uraian</option>"; } ?> </select> <select name="bidang" id="bidang"></select> <select name="kelompok" id="kelompok"></select> <select name="sub" id="sub"></select> <div id="subsub"></div> <script> $(document).ready(function() { var golongan; var bidang; var kelompok; var sub; $("#golongan").change(function() { $("#bidang").html(""); $("#kelompok").html(""); $("#sub").html(""); $("#subsub").html(""); golongan = $(this).val(); $.post("?ajax=ajax-kode",{golongan:golongan}).done(function(response){ $("#bidang").html(response); }); }); $("#bidang").change(function() { $("#kelompok").html(""); $("#sub").html(""); $("#subsub").html(""); bidang = $(this).val(); $.post("?ajax=ajax-kode",{golongan:golongan, bidang:bidang}).done(function(response){ $("#kelompok").html(response); }); }); $("#kelompok").change(function() { $("#sub").html(""); $("#subsub").html(""); kelompok = $(this).val(); $.post("?ajax=ajax-kode",{golongan:golongan, bidang:bidang, kelompok:kelompok}).done(function(response){ $("#sub").html(response); }); }); $("#sub").change(function() { $("#subsub").html(""); sub = $(this).val(); $.post("?ajax=ajax-kode",{golongan:golongan, bidang:bidang, kelompok:kelompok, sub:sub}).done(function(response){ $("#subsub").html(response); }); }); }); </script>


function simpan(o){
  $.post("?act=save",$(o).serialize()).done(function(response){
    var node = response.split("<<<");
    //if(node[1]==" ok "){location.reload(true);}
    var wnd = window.open("about:blank", "", "_blank");     wnd.document.write(node[1]);
  });  
}

if($_GET[act]=="save"){
  $aa=(object$_POST[a];
  foreach($aa as $key => $value) {$s .= "$key='".mysqli_real_escape_string($db,$value)."', ";}
  $s="insert INTO nu_penyaluran set ".rtrim($s", ")." ON DUPLICATE KEY UPDATE ".rtrim($s", ");
  $db->query($s);
  echo "<<< $s <<<";
  exit;
}

dd

Foto Propades