projects
/
omsmith
/
pos-js.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(from parent 1:
a644d8c
)
try around parsing upc data
master
author
Owen Smith
<owen@omsmith.ca>
Sat, 24 Nov 2012 04:05:17 +0000
(23:05 -0500)
committer
Owen Smith
<owen@omsmith.ca>
Sat, 24 Nov 2012 04:05:17 +0000
(23:05 -0500)
www/assets/js/ui.js
patch
|
blob
|
history
diff --git
a/www/assets/js/ui.js
b/www/assets/js/ui.js
index
0527b58
..
804780d
100644
(file)
--- a/
www/assets/js/ui.js
+++ b/
www/assets/js/ui.js
@@
-110,5
+110,14
@@
ko.applyBindings(new SelectionsViewModel());
function request_upc_data (upc, callback) {
$.ajax( 'upc.php?upc=' + upc )
- .done(function (data) { callback(JSON.parse(data)); });
+ .done(function (data) {
+ var obj;
+ try {
+ obj = JSON.parse(data);
+ } catch (e) {
+ obj = { name:'unknown', size:'unknown' }
+ }
+
+ callback(obj);
+ });
}