Skip to content

Instantly share code, notes, and snippets.

@fadrizul
Created October 15, 2012 07:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fadrizul/3891284 to your computer and use it in GitHub Desktop.
Save fadrizul/3891284 to your computer and use it in GitHub Desktop.
var url = server + '/customers/activate';
var activateJSON = { id:"0192268455",activationCode:"6450" };
$.ajax({
url: server + '/customers/activate',
type: 'POST',
async: true,
data: activateJSON,
contentType: "application/json",
dataType: 'json',
xhrFields: {
withCredentials: true
},
success: function(data) {
var bookings = {
name: 'Passenger' // Name of the passenger
, phoneNumber: '0123456789' // Passenger's phone number
, date: '16/01/2015' // Format should be in DD/MM/YYY
, time: '05:55 PM' // Format should be in HH:mm A
, pickUp : {
keyword: 'Jalan Kemajuan' // Pick up keyword
, location: 'Jalan Kemajuan, Seksyen 12 Petaling Jaya' // Full address of the pickup address *Optional*
, latlong: '3.1110223, 101.63866970000004' // Latlng of the pickUp point
, notes: 'Yellow building' // *Optional*
}
, dropOff: {
keyword: 'Jalan Kemajuan' // Pick up keyword
, location: 'Jalan Kemajuan, Seksyen 12 Petaling Jaya' // Full address of the pickup address *Optional*
, latlong: '3.1110223, 101.63866970000004' // Latlng of the pickUp point
, notes: 'Yellow building' // *Optional*
}
, immediate: true // If advance booking set this to false.
, remarks: '+RM5 Please honk when arrive, will be standing at the bus stop' // Notes to send to drivers.
, mobile: true // Always set this to true
, type: 'web' // Options are; ios, venue, ios2, android, windows, winphone, web
, taxiType: 'budget' // Options are: budget, executive, premium or all
};
console.log(bookings);
$.ajax({
url: server + '/book/createBooking',
type: 'POST',
async: true,
data: bookings,
contentType: "application/json",
dataType: 'json',
xhrFields: {
withCredentials: true
},
success: function(data) {
console.log('success');
console.log(data);
},
error: function(data) {
console.log('error');
console.log(data);
},
complete: function(data) {
console.log('complete:');
console.log(data);
}
});
},
error: function(data) {
console.log('error');
console.log(data);
},
complete: function(data) {
console.log('complete:');
console.log(data);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment