[英]How to send XML request in JavaScript
I have an eye tracker (mirametrix) running as a server in localhost.我有一个眼动仪(mirametrix)作为本地主机中的服务器运行。 In order to capture data from this I should send a xml request as given below;
为了从中捕获数据,我应该发送一个 xml 请求,如下所示;
SEND:<GET ID="TIME_TICK_FREQUENCY" />
I have a web-app running as the client and I need to make a request to this server through that.我有一个作为客户端运行的网络应用程序,我需要通过它向该服务器发出请求。 I wrote the following code but it doesn't seem to send the request properly to the server.
我编写了以下代码,但它似乎没有将请求正确发送到服务器。
var request = $.ajax({
url: "http://127.0.0.1:4242",
type: "GET",
dataType: "xml",
data: {
data:'<GET ID="TIME_TICK_FREQUENCY" />'
},
});
Can someone please help me with this ?有人可以帮我解决这个问题吗?
Thanks in advance提前致谢
$.ajax({
url: ajaxurl,
data: "<root><blah><blah></root>",
type: 'POST',
contentType: "text/xml",
dataType: "text",
success : parse,
error : function (xhr, ajaxOptions, thrownError){
console.log(xhr.status);
console.log(thrownError);
}
});
I think you need to post it.我认为你需要发布它。
this is not plain javascript.. looks more like jquery.. also what do you mean with 'properly'.这不是普通的 javascript.. 看起来更像 jquery.. 还有你所说的“正确”是什么意思。 It's kind sending it, but not really?
发送它很友好,但不是真的吗? Aside from that, I see the following problems
除此之外,我看到以下问题
<?xml version="1.0"?>
.<?xml version="1.0"?>
开头。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.