Published June 30, 2019 by RIT with 0 comment

HOW TO INSERT AJAX IN PHP

Assalamualaikum warohmatullohi wabarokatuh,
Wa alaikum salama warohmatullohi wabarokatuh,

cara input data dengan ajax
how to insert ajax in php

1 - buatlah file index.php
2 - buat file lagi dengan nama create_proses.php
3 - copy script dibawah ini sesuaikan dengan file index.php dan create_proses.php

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php 
$koneksi = mysqli_connect('localhost','root','','test');
?>
<script type="text/javascript" src="jquery.js"></script>
 
<!-- form untuk menambah data -->
<form method='post' class='form-input'>
    <input type='text' name='nama' >
    <input type='submit' class='save' value='submit'>
</form>
 
<!-- script menampilkkan data -->
<?php 
$q  = 'SELECT * FROM tb_siswa';
$q2 = mysqli_query($koneksi, $q);
 
?>
 
<table border="1" >
    <tr bgcolor="yellow" align="center">
        <td>NAME</td>
    </tr>
 
<?php while ( $row = mysqli_fetch_array($q2)) { ?>
    <tr>
        <td><?php echo $row['nama']; ?></td>
    </tr>
<?php } ?>
 
</table>
 
<!-- script jquery ajax input data -->
<script type="text/javascript">
  $(document).ready(function(){
      $(".save").click(function(id){
        
           var data = $('.form-input').serialize();
           var notif = alert('insert success ... !!!');
        
            $.ajax({
              type: 'POST',
              url: "create_proses.php",
              cache: false,
              data: data,
              success: function(notif){
                  location.reload();
                }
            });
          });
      });
</script>

1
2
3
4
5
6
7
<?php 
require_once 'index.php';
$nama   $_POST['nama'];
$query  "INSERT INTO tb_siswa (nama) VALUES ('$nama')";
$query2 = mysqli_query($koneksi,$query);
return $query2;
 ?>



berikut adalah hasil dari script ajax php.


Terima Kasih
Thank's

TAG TAGS :
how to insert ajax php | cara input data dengan ajax | cara insert data dengan ajax php | cara menampilkan data tanpa refresh | input data ke database tanpa refresh | script sederhana crud ajax php | script simple crud ajax php | script crud php | script crud php ajax | download script ajax | scripts ajax jquery | script ajax jquery | how to insert ajax in php | how to insert ajax in html | script insert php ajax | how to insert ajax loader | how to insert data using ajax in php | how to insert using ajax in php | how to add ajax in php | PHP Ajax Scripts | Free PHP Ajax Scripts | PHP Ajax Downloads |


BACA JUGA :
Read More
      edit
Published June 27, 2019 by RIT with 0 comment

HOW TO DELETE AJAX IN PHP

assalamualaikum warohmatullohi wabarokatuh,
wa alaikum salam warohmatullohi wabarokatuh,

CARA HAPUS MENGGUNAKAN AJAX JQUERY
HOW TO DELETE WITH AJAX IN PHP AND MYSQL

1 - buatlah file index.php
2 - buat file lagi dengan nama proses_delete.php
3 - copy script dibawah ini sesuaikan dengan file index.php dan proses_delete.php

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<script type="text/javascript" src="jquery.js"></script>
 
<?php 
$koneksi = mysqli_connect('localhost','root','','test'); 
 
$q  = 'SELECT * FROM tb_siswa';
$q2 = mysqli_query($koneksi, $q);
 
?>
 
<table border="1" >
    <tr bgcolor="yellow" align="center">
        <td>NAME</td>
        <td>OPERATION</td>
    </tr>
 
<?php while ( $row = mysqli_fetch_array($q2)) { ?>
    <tr>
        <td><?php echo $row['nama']; ?></td>
        <td><button class='delete' id="<?php echo $row['id']; ?>">delete</button></td>
    </tr>
<?php } ?>
 
 
</table>
 
 
 
<script type="text/javascript">
  $(document).ready(function(){
        $(".delete").click(function(){
            var id_hapus = $(this).attr('id');
               $.ajax({
                      type:'POST',
                      url:'proses_delete.php',
                      data:'id='+id_hapus,
                      success:function(data){
                        location.reload();
                    }
                });         
             });
          });
</script>
1
2
3
4
5
6
7
8
9
<?php
include 'index.php'
 
$id $_POST['id'];
$q  "DELETE FROM tb_siswa WHERE id='$id'";
$q2 = mysqli_query($koneksi,$q);
return $q2;
 
 ?>

TAG TAGS :
simple code | simple code ajax | simple code ajax delete | code ajax delete | script ajax delete | script ajax delete php | free download script ajax | download script ajax | how to delete ajax php | how to ajax delete php | how to ajax delete in php and mysql | script delete ajax in php and mysql script simple delete ajax in php | simple delete ajax in php | download script delete ajax in | php download script ajax | delete ajax in php | delete ajax php | cara ajax dengan php | cara ajax delete | cara delete dengan ajax | cara delete data php | cara membuat delete php | cara delete dengan php | ajax jquery delete data | ajax delete data | script delete data di php | script delete php | php native | how to delete ajax using php | delete using ajax | how to delete php |


BACA JUGA :
Read More
      edit
Published June 22, 2019 by RIT with 0 comment

HOW TO INSTALL LARAVEL DIFFERENT VERSION ON COMPOSER



Assalamualaikum, Warohmatullohi Wabarokatuh, 
Wa alaikum salam Warohmatullohi Wabarokatuuh

how to install laravel different version on composer
cara instal laravel sesuai dengan versi yg kita inginkan
script install laravel old version

composer create-project --prefer-dist laravel/laravel project-name "5.5.*"

and you can changed version 5.5 to 5.3 or 5.2 etc
like the following example :
dan kamu bisa ubah  5.5 menjadi 5.3 atau 5.2 dan seterusnya.
seperti contoh berikut ini :

composer create-project --prefer-dist laravel/laravel project-name "5.2.*"

Thanks :)
Terima kasih

TAG TAGS :
how to | how to install laravel different version on composer | cara instal laravel sesuai dengan versi yg kita inginkan | cara instal laravel versi lama | script install laravel old version
Read More
      edit
Published June 22, 2019 by RIT with 0 comment

HOW TO SWITCH IN MATERIALIZE ?


assalamualaikum, warohmatullohi wabarokatuh.
wa alaikum salam warohmatullohi wabarokatuh.

bagaimana cara menggunakan switch pada materialize?
how to checked in materialized by id ?

berikut kodenya :
this is code :


  
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<script src="https://code.jquery.com/jquery-3.4.1.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
 
<form name="formnya">
 
<p id="public">d</p>   
 
  <div class="switch">
    <label>
      Draft
      <input type="checkbox" name='post_type' id="d">
      <span class="lever"></span>
      publish
    </label>
  </div>
 
</form>
 
<script type="text/javascript">
 
    if ($('#d').prop('checked')== true){
        alert("anda memilih public");
    }else if ($('#d').prop('checked')==false){
        alert('tersimpan draft');
    }
 
</script>
 

  
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
<script src="https://code.jquery.com/jquery-3.4.1.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>

<form name="formnya">

<p id="public">d</p>    

  <div class="switch">
    <label>
      Draft
      <input type="checkbox" name='post_type' id="d">
      <span class="lever"></span>
      publish
    </label>
  </div>

</form>

<script type="text/javascript">

    if ($('#d').prop('checked')== true){
        alert("anda memilih public");
    }else if ($('#d').prop('checked')==false){
        alert('tersimpan draft');
    }

</script>

pada baris 12 setelah atribut kamu bisa menambahkan script checked dan
setelah mengetahui hasilnya coba kamu hapus script checked nya untuk mengetahui hasilnya.

Terima Kasih
 Thanks

TAG TAGS :
Jquery || how to if in jquery || cara if checked dengan jquery || materialize || cara checked menggunakan materialize || if condition checked redirect to index if condition not checked redirect to page different
Read More
      edit