I'm trying to access a control processor that has a built in web server. Based on the specific values that are programmed into the controller I am able to trigger actions through a website that resides on its built in server using jQuery or js. I'm having an issue though with the jQuery post command. When I use goggle's REST plugin everything works and I successfully get a response. Any ideas?
function GetVariableValuesByName(name) {
$.post("http://10.10.254.11/RPC/", {
method: "GetVariableValuesByName",
param1: name,
encoding: "2"
}).done(function (data) {
data = String(data);
var info = data.responseText;
alert(info);
}).fail(function (data) {
data = String(data);
alert("error " + data)
}).always(function (data) {
data = String(data);
alert("just in case " + data);
});
}
Some additional examples the last function example assumes I've created the xmlhttp object.
function GetVariableValuesByName(name) {
$.ajax({
type: "POST",
url: "http://10.10.254.11/RPC/",
data: { method: "GetVariableValueByName", param1: "VOL_BAR", encoding: "2" }
}).done(function( msg ) {
alert( "Data Saved: " + msg );
}).fail(function(msg) {
alert("error " + msg)
});
}
function GetVariableValuesByName(name) {
xmlhttp.open("POST","http://10.10.254.11/RPC/",false);
var theString = "method=GetVariableValueByName¶m1=" + name;
xmlhttp.setRequestHeader ("Content-Type", "application/x-www-form-urlencoded");
xmlhttp.send(theString);
var wacivar = xmlhttp.responseText;
wacivar = String(wacivar);
wacivar = wacivar.substr(19);
alert(wacivar);
}