Skip to content
Snippets Groups Projects
Commit 487345c6 authored by Arya Pradipta's avatar Arya Pradipta
Browse files

test di server

parent 955c3ea1
No related merge requests found
Pipeline #4501 passed with stages
in 8 minutes and 42 seconds
...@@ -99,6 +99,7 @@ ...@@ -99,6 +99,7 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<script src="https://unpkg.com/feather-icons/dist/feather.min.js"></script> <script src="https://unpkg.com/feather-icons/dist/feather.min.js"></script>
<script src="http://malsup.github.com/jquery.form.js"></script>
<script> <script>
$(document).ready(function(){ $(document).ready(function(){
......
...@@ -39,9 +39,14 @@ ...@@ -39,9 +39,14 @@
<input class="input-file" id="PDFinput" type="file" name="pdffile" disabled accept="application/pdf"> <input class="input-file" id="PDFinput" type="file" name="pdffile" disabled accept="application/pdf">
</div> </div>
<button type="submit" class="btn btn-default">Kirim</button> <button type="submit" class="btn btn-default">Kirim</button>
<div class="progress">
<div class="bar"></div>
<div class="percent">0%</div>
</div>
</form> </form>
<script> <script>
$.getJSON("../getAllTopik.php",function(data){ $.getJSON("../getAllTopik.php",function(data){
var select = document.getElementById("sel1"); var select = document.getElementById("sel1");
...@@ -82,21 +87,44 @@ ...@@ -82,21 +87,44 @@
} }
}); });
$("#upload_form").on("submit", function(e){ var bar = $('.bar');
e.preventDefault(); var percent = $('.percent');
$.ajax({
url: "../addMateri.php", // Url to which the request is send $('form').ajaxForm({
type: "POST", // Type of request to be send, called as method beforeSend: function() {
data: new FormData(this), // Data sent to server, a set of key/value pairs (i.e. form fields and values) var percentVal = '0%';
contentType: false, // The content type used when sending data to the server. bar.width(percentVal)
cache: false, // To unable request pages to be cached percent.html(percentVal);
processData:false, // To send DOMDocument or non processed data file it is set to false },
success: function(data) // A function to be called if request succeeds uploadProgress: function(event, position, total, percentComplete) {
{ var percentVal = percentComplete + '%';
// lakukan pemanggilan api notifikasi bar.width(percentVal)
alert(data); percent.html(percentVal);
},
success: function() {
var percentVal = '100%';
bar.width(percentVal)
percent.html(percentVal);
},
complete: function(xhr) {
alert(xhr.responseText);
} }
}); });
}); // $("#upload_form").on("submit", function(e){
// e.preventDefault();
// $.ajax({
// url: "../addMateri.php", // Url to which the request is send
// type: "POST", // Type of request to be send, called as method
// data: new FormData(this), // Data sent to server, a set of key/value pairs (i.e. form fields and values)
// contentType: false, // The content type used when sending data to the server.
// cache: false, // To unable request pages to be cached
// processData:false, // To send DOMDocument or non processed data file it is set to false
// success: function(data) // A function to be called if request succeeds
// {
// // lakukan pemanggilan api notifikasi
// alert(data);
// }
// });
// });
</script> </script>
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment