Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- =========== FILE JS==========
- $(".btn-push").click(function(){
- sync();
- });
- function sync() {
- $.ajax({
- type: "POST",
- url: urlSync,
- beforeSend: function(){
- .................
- },
- success: function(temp) {
- temps = $.parseJSON(temp);
- triger(temps.status); //buat men-triger proses sync
- bar(temps.proses,temps.persen,temps.jml,temps.total);
- ............
- },
- error: function () {
- ................
- },
- });
- }
- function triger(status){
- if(status) {
- sync();
- return;
- }
- }
- function bar(proses,persen,jml,total) {
- $(".progress-text").html("Proses "+proses);
- $(".progress-bar").css("width",persen+"%");
- $(".progress-number").html(persen+"%");
- $("#progress-result").html("Result: ("+jml+"/"+total+")");
- }
- =================controller
- output format json
- .........
- echo Json::encode([
- 'persen' => $persen,
- 'pesan' => $pesan,
- 'proses' => $proses,
- 'status' => $status,
- 'hasil' => $hasil,
- 'jml' => number_format($count_sync-1),
- 'total' => number_format($total),
- ]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement