$( "#send" ).click(function() { $( "#send" ).text("Sedang Mencari..."); $("#progress-bar").show(); $('.progress-bar').css('width', 1 +'%');
var courier = [];
$.each($("input[name='courier']:checked"), function(){
courier.push($(this).val());
});
var couriers = courier.join(":");
var navigationFn = { goToSection: function(id) { $('html, body').animate({ scrollTop: $(id).offset().top }, 0); } }
var IdOrigin = $( "#origin" ).val(); var OriginType = $( "#origin_type" ).val(); var IdDest = $( "#destination" ).val(); var DestType = $( "#destination_type" ).val(); var Weight = $( "#weight" ).val();
var request = $.ajax({ url: "http://cek-ongkir.com/cost", method: "POST", data: { origin : IdOrigin, originType : OriginType, destination : IdDest , destinationType : DestType , weight : Weight, courier : couriers }, dataType: "html" });
request.done(function( msg ) { $("#data").html(msg); navigationFn.goToSection('#result'); $( "#send" ).text('Cek Ongkir!');
});
request.fail(function( jqXHR, textStatus ) { alert( "Request failed: " + textStatus ); });
});
$('#international-link').click(function() {
var request = $.ajax({ url: "http://cek-ongkir.com/country", dataType: "html" });
request.done(function( msg ) { $("select#country").html(msg); });
request.fail(function( jqXHR, textStatus ) { alert( "Request failed: " + textStatus ); });
});
$( "#inter-send" ).click(function() {
$("#inter-send").text(" Sedang Mencari...");
var navigationFn = { goToSection: function(id) { $('html, body').animate({ scrollTop: $(id).offset().top }, 0); } }
var IdOrigin = $( "#origin-city" ).val(); var IdDest = $( "#country" ).val(); var Weight = $( "#inter-weight" ).val(); var Courier = $( "#inter-courier" ).val(); var request = $.ajax({ url: "http://cek-ongkir.com/international/cost", method: "POST", data: { origin : IdOrigin, destination : IdDest, weight : Weight, courier : Courier}, dataType: "html" });
request.done(function( msg ) { $("#data").html(msg); navigationFn.goToSection('#result'); $("#inter-send").text("Cek Ongkir!"); });
request.fail(function( jqXHR, textStatus ) { alert( "Request failed: " + textStatus ); });
});