Kamis, 22 Agustus 2019

HTML Assets Post Data to Android




<html lang="en">
<head>
  <meta charset="utf-8">
  <title>HTML POST</title>
  <script src="https://code.jquery.com/jquery-1.10.2.js"></script>
</head>
<body>

<form action="http://localhost/aplikasi/add.php?&ket=register via HTML" id="searchForm">
  <input type="text" name="nama_user" placeholder="Search...">
  <input type="submit" value="Search">
</form>
<div id="result"></div>

<script>


$( "#searchForm" ).submit(function( event ) {

  // Stop form from submitting normally
  event.preventDefault();

  // Get some values from elements on the page:
  var $form = $( this ),
    term = $form.find( "input[name='s']" ).val(),
    url = $form.attr( "action" );

  // Send the data using post post
  var posting = $.get( url, { s: term } );

  // Put the results in a div
  posting.done(function( data ) {
    var content = $( data ).find( "#content" );
    $( "#result" ).empty().append( content );
  alert( "success" );
  });
});
</script>

</body>
</html>

++++++++++++++++++++++++++++++++++++THE PHP

$nama_user=$_GET["nama_user"];
$ket=$_GET["ket"];

$sql="INSERT INTO `tb_user`
(`id_user`, `nama_user`,  `keterangan`) VALUES('', '$nama_user', '$ket')";

$simpan=process($conn,$sql);
echo"#content:sukses";
+++++++++++++++++++++++++++++++++++++



Tidak ada komentar:

Posting Komentar