function sendRequest(data)
{
loadingMask('show');
$.ajax({
dataType: "json",
type: "POST",
url: "/admin/property/valuation-request/1",
data: data,
success: function (response) {
if (response.success === true) {
loadingMask('hide');
viewSuccess(response, data);
} else {
loadingMask('hide');
throwError(response);
}
}
}); //ajax
}
var innerData = {
repEmail: repEmail,
appointmentTime: time
};
data = {
reference: '<?php echo $this->reference; ?>',
action: 'notify',
data: innerData,
url: '/admin/property/valuation-request/1'
};
$('#notify-rep').click(function() {
var repEmail = $('#representative').val(),
time = $('#time').val();
if (isEmpty(repEmail) === false && isEmpty(repEmail) === false) {
var innerData = {
repEmail: repEmail,
appointmentTime: time
};
data = {
reference: '<?php echo $this->reference; ?>',
action: 'notify',
data: innerData,
url: '/admin/property/valuation-request/1'
};
sendRequest(data);
} else {
alert('You need to assign a representative and a time first.');
}
});