1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Use jquery ajax rather than d3

This commit is contained in:
Nick O'Leary 2014-11-12 11:30:30 +00:00
parent 42cd6f94a7
commit 66005a2688

View File

@ -477,21 +477,23 @@
var label = (this.name||this.payload).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"); var label = (this.name||this.payload).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");
if (this.payloadType === "date") { label = "timestamp"; } if (this.payloadType === "date") { label = "timestamp"; }
if (this.payloadType === "none") { label = "blank"; } if (this.payloadType === "none") { label = "blank"; }
d3.xhr("inject/"+this.id).post(function(err,resp) {
if (err) { $.ajax({
if (err.status == 404) { url: "inject/"+this.id,
type:"POST",
success: function(resp) {
RED.notify("Successfully injected: "+label,"success");
},
error: function(jqXHR,textStatus,errorThrown) {
if (jqXHR.status == 404) {
RED.notify("<strong>Error</strong>: inject node not deployed","error"); RED.notify("<strong>Error</strong>: inject node not deployed","error");
} else if (err.status == 500) { } else if (jqXHR.status == 500) {
RED.notify("<strong>Error</strong>: inject failed, see log for details.","error"); RED.notify("<strong>Error</strong>: inject failed, see log for details.","error");
} else if (err.status == 0) { } else if (jqXHR.status == 0) {
RED.notify("<strong>Error</strong>: no response from server","error"); RED.notify("<strong>Error</strong>: no response from server","error");
} else { } else {
RED.notify("<strong>Error</strong>: unexpected error: ("+err.status+")"+err.response,"error"); RED.notify("<strong>Error</strong>: unexpected error: ("+jqXHR.status+")"+textStatus,"error");
} }
} else if (resp.status == 200) {
RED.notify("Successfully injected: "+label,"success");
} else {
RED.notify("<strong>Error</strong>: unexpected response: ("+resp.status+") "+resp.response,"error");
} }
}); });
} }