Skip to content

Commit 1846400

Browse files
authored
Catch when data is not json
1 parent d62a50e commit 1846400

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

page-foundation.js

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,23 @@ $.ajaxSetup({
2222
}
2323
},
2424
dataFilter: function(data, type) {
25-
url = JSON.parse(data);
26-
27-
if (typeof url === 'string' && url.substring(0, 4) === 'http') {
28-
$('#toast-container .toast').trigger('click');
29-
toastr.info("Loading page...", '', {timeOut: 0});
30-
31-
if (window.location.href == url) {
32-
location.reload(true);
25+
try {
26+
url = JSON.parse(data);
27+
28+
if (typeof url === 'string' && url.substring(0, 4) === 'http') {
29+
$('#toast-container .toast').trigger('click');
30+
toastr.info("Loading page...", '', {timeOut: 0});
31+
32+
if (window.location.href == url) {
33+
location.reload(true);
34+
}
35+
36+
window.location.href = url;
37+
38+
return false;
3339
}
34-
35-
window.location.href = url;
36-
37-
return false;
40+
} catch (exception) {
41+
3842
}
3943

4044
return data;

0 commit comments

Comments
 (0)