Created
June 25, 2020 05:15
-
-
Save blogcacanid/47f1e874b940a292893824bf67a3152f to your computer and use it in GitHub Desktop.
app.js Cek Ongkos Kirim Dengan RajaOngkir PHP 7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$( document ).ready(function() { | |
$('#kota_asal').select2({ | |
placeholder: '--Pilih kota/kabupaten asal--', | |
language: "id" | |
}); | |
$('#kota_tujuan').select2({ | |
placeholder: '--Pilih kota/kabupaten tujuan--', | |
language: "id" | |
}); | |
$.ajax({ | |
type: "GET", | |
dataType: "html", | |
url: "get_kota.php?q=kotaasal", | |
success: function(msg){ | |
$("select#kota_asal").html(msg); | |
} | |
}); | |
$.ajax({ | |
type: "GET", | |
dataType: "html", | |
url: "get_kota.php?q=kotatujuan", | |
success: function(msg){ | |
$("select#kota_tujuan").html(msg); | |
} | |
}); | |
$("#ongkir").submit(function(e) { | |
e.preventDefault(); | |
$.ajax({ | |
url: 'cek_ongkir.php', | |
type: 'post', | |
data: $( this ).serialize(), | |
success: function(data) { | |
console.log(data); | |
document.getElementById("response_ongkir").innerHTML = data; | |
} | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment