public
Created — forked from jibone/gist:3891262

  • Download Gist
gistfile1.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
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);
}
});

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.