dimar_hanung

POST method html

Feb 17th, 2020
90
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.     <meta charset="UTF-8">
  5.     <title>rest server</title>
  6.     <script src="jquery-3.4.1.min.js"></script>
  7.     <!-- <script src="asset/bootstrap/js/bootstrap.min.js"></script> -->
  8.     <!-- <link rel="stylesheet" type="text/css" href="asset/bootstrap/css/bootstrap.min.css"> -->
  9. </head>
  10. <body>
  11.    
  12.    
  13.  
  14.  
  15.  
  16.  
  17.     <script type="text/javascript">
  18.        
  19. let update={
  20.     "id" : "71",
  21.     "name" : "akhirnya update2",
  22.     "price" : "255",
  23.     "description" : "The best pillow for amazing programmers.",
  24.     "category_id" : 2,
  25.     "created" : "2018-08-01 00:35:07"
  26. }
  27.  
  28. let data= {
  29.     "name" : "akhirnya",
  30.     "price" : "199",
  31.     "description" : "The best pillow for amazing programmers.",
  32.     "category_id" : 2,
  33.     "created" : "2018-06-01 00:35:07"
  34. }
  35.  
  36.  
  37. function cek(){
  38. $.ajax({
  39.  
  40.             type: "POST",
  41.             contentType: "application/json; charset=utf-8",
  42.             url: "http://192.168.100.17/laravel/restapi8/api/product/read.php",
  43.             data: '{}',
  44.             dataType: "json",
  45.             success: function (data) {
  46.                 console.log(data.records[4].price);
  47.             },
  48.             error: function (result) {
  49.                 alert("Error");
  50.             }
  51.         });
  52.  
  53.     }
  54.  
  55.    
  56.  
  57.     </script>
  58.  
  59. </body>
  60. </html>
RAW Paste Data