aboutsummaryrefslogtreecommitdiffstats
path: root/phonegap/www/js/mobile.js
diff options
context:
space:
mode:
Diffstat (limited to 'phonegap/www/js/mobile.js')
-rw-r--r--phonegap/www/js/mobile.js16
1 files changed, 14 insertions, 2 deletions
diff --git a/phonegap/www/js/mobile.js b/phonegap/www/js/mobile.js
index 554872a70..01c87fab4 100644
--- a/phonegap/www/js/mobile.js
+++ b/phonegap/www/js/mobile.js
@@ -187,8 +187,19 @@ function takePhoto(type) {
function fileUploadSuccess(r) {
console.log( r.response );
console.log( typeof r.response );
- if ( r.response.indexOf( 'success' ) >= 0 ) {
- window.location = 'email_sent.html';
+ if ( r.response ) {
+ var data = JSON.parse( r.response );
+ if ( data.success ) {
+ if ( data.report ) {
+ localStorage.report = data.report;
+ window.location = 'report_created.html';
+ } else {
+ window.location = 'email_sent.html';
+ }
+ } else {
+ alert('Could not submit report');
+ $('input[type=submit]').prop("disabled", false);
+ }
} else {
alert('Could not submit report');
$('input[type=submit]').prop("disabled", false);
@@ -197,6 +208,7 @@ function fileUploadSuccess(r) {
function fileUploadFail() {
alert('Could not submit report');
+ $('input[type=submit]').prop("disabled", false);
}