Skip to content

Instantly share code, notes, and snippets.

@juiceByStaplez
Created August 10, 2015 20:17
Show Gist options
  • Save juiceByStaplez/cb150fa45da0d5823ad7 to your computer and use it in GitHub Desktop.
Save juiceByStaplez/cb150fa45da0d5823ad7 to your computer and use it in GitHub Desktop.
$.post('http://instasandbox.com/wp/wp-login.php', r, function() {
if(r['appt-form']) {
$.post('inc/functions/_post/patient.php', {
action: 'survey-check',
doctor_id: '144'
}, function(r) {
data = $.parseJSON(r);
console.log(data.survey);
if(data.survey == false) {
window.location.href = 'home?p=survey';
} else if(data.survey == true) {
$.post('inc/global/sessions.php', {
action: 'get',
key: 'appt_form'
}, function(r) {
document.documentElement.className += ' js';
r = JSON.parse(r);
r.action = 'make-appt';
var doctor_name = "Jay Wisnicki";
doctor_name = doctor_name.toLowerCase().replace(' ', '-');
var formData = r;
$.post('inc/functions/_post/patient.php', r, function(r) {
$('html').removeClass('js');
r = JSON.parse(r);
if(r.success == true) {
smoke.confirm(r.data, function(e) {
if (e) {
window.location.href = insta_home_url + "/home/?p=appointments";
}
}, {
ok: "View Appointments",
cancel: "Close",
reverseButtons: true
});
} else {
smoke.confirm(r.data, function(e) {
if(e) {
window.location.href = insta_home_url + '/listing/'+doctor_name;
}
}, {
ok: 'Try again',
cancel: 'Close',
reverseButtons: true
});
}
});
});
}
});
} else {
// window.location.href = "http://instasandbox.com/home/";
console.log('condition failed');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment