mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 22:13:26 +00:00
Change from deprecated $.parseJSON to JSON.parse.
The jQuery function `parseJSON` is now deprecated so we should push to switch to native `JSON.parse` since all browsers support it.
This commit is contained in:
committed by
Tim Abbott
parent
10265dbbd9
commit
ac4ac63353
@@ -53,7 +53,7 @@ exports.set_up = function () {
|
||||
error: function (xhr) {
|
||||
if (xhr.status.toString().charAt(0) === "4") {
|
||||
btn.closest("td").html(
|
||||
$("<p>").addClass("text-error").text($.parseJSON(xhr.responseText).msg)
|
||||
$("<p>").addClass("text-error").text(JSON.parse(xhr.responseText).msg)
|
||||
);
|
||||
} else {
|
||||
btn.text(i18n.t("Failed!"));
|
||||
@@ -88,7 +88,7 @@ exports.set_up = function () {
|
||||
ui_report.success(i18n.t("Custom filter added!"), filter_status);
|
||||
},
|
||||
error: function (xhr) {
|
||||
var errors = $.parseJSON(xhr.responseText).errors;
|
||||
var errors = JSON.parse(xhr.responseText).errors;
|
||||
if (errors.pattern !== undefined) {
|
||||
xhr.responseText = JSON.stringify({msg: errors.pattern});
|
||||
ui_report.error(i18n.t("Failed"), xhr, pattern_status);
|
||||
|
||||
@@ -311,7 +311,7 @@ $.get({
|
||||
update_last_full_update(data.end_times);
|
||||
},
|
||||
error: function (xhr) {
|
||||
$('#id_stats_errors').show().text($.parseJSON(xhr.responseText).msg);
|
||||
$('#id_stats_errors').show().text(JSON.parse(xhr.responseText).msg);
|
||||
},
|
||||
});
|
||||
|
||||
@@ -533,7 +533,7 @@ $.get({
|
||||
update_last_full_update(data.end_times);
|
||||
},
|
||||
error: function (xhr) {
|
||||
$('#id_stats_errors').show().text($.parseJSON(xhr.responseText).msg);
|
||||
$('#id_stats_errors').show().text(JSON.parse(xhr.responseText).msg);
|
||||
},
|
||||
});
|
||||
|
||||
@@ -651,7 +651,7 @@ $.get({
|
||||
update_last_full_update(data.end_times);
|
||||
},
|
||||
error: function (xhr) {
|
||||
$('#id_stats_errors').show().text($.parseJSON(xhr.responseText).msg);
|
||||
$('#id_stats_errors').show().text(JSON.parse(xhr.responseText).msg);
|
||||
},
|
||||
});
|
||||
|
||||
@@ -723,6 +723,6 @@ $.get({
|
||||
update_last_full_update(data.end_times);
|
||||
},
|
||||
error: function (xhr) {
|
||||
$('#id_stats_errors').show().text($.parseJSON(xhr.responseText).msg);
|
||||
$('#id_stats_errors').show().text(JSON.parse(xhr.responseText).msg);
|
||||
},
|
||||
});
|
||||
|
||||
@@ -341,7 +341,7 @@
|
||||
|
||||
if (xhr.responseText) {
|
||||
try {
|
||||
serverResponse = jQuery.parseJSON(xhr.responseText);
|
||||
serverResponse = JSON.parse(xhr.responseText);
|
||||
}
|
||||
catch (e) {
|
||||
serverResponse = xhr.responseText;
|
||||
|
||||
@@ -644,10 +644,7 @@ $.fn.ajaxSubmit = function(options) {
|
||||
}
|
||||
return (doc && doc.documentElement && doc.documentElement.nodeName != 'parsererror') ? doc : null;
|
||||
};
|
||||
var parseJSON = $.parseJSON || function(s) {
|
||||
/*jslint evil:true */
|
||||
return window['eval']('(' + s + ')');
|
||||
};
|
||||
var parseJSON = $.parseJSON || JSON.parse;
|
||||
|
||||
var httpData = function( xhr, type, s ) { // mostly lifted from jq1.4.4
|
||||
|
||||
|
||||
Reference in New Issue
Block a user