我想从Jquery ajax https://sisa.msal.gov.ar/sisa/services/rest/puco/44003375
中获取此URL中的XML通过浏览器我可以看到:
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<puco>
<resultado>OK</resultado>
<coberturaSocial>O.S.P. CIUDAD AUT</coberturaSocial>
<denominacion>AGOSTINO RODRIGO LEONARDO</denominacion>
<nrodoc>44003375</nrodoc>
<rnos>901001</rnos>
<tipodoc>DNI</tipodoc>
</puco>
但在做的时候:
var id=44003375;
$.ajax({
type : "GET",
url : 'https://sisa.msal.gov.ar/sisa/services/rest/puco/'+id,
dataType :"JSONP",
jsonp: true,
success : function(xhr){
alert(JSON.stringify(xhr));
},
error : function(httpReq,status,exception){
var clientid = $(httpReq).text();
alert(JSON.stringify(httpReq));
}
});
返回“解析错误”...我如何通过ajax获取浏览器显示的内容?
答案 0 :(得分:0)
使用JavaScript .load()
,然后将XML解析为JSON as detailed here
答案 1 :(得分:0)
您将需要使用任何xml到json转换器或解析器。看看http://goessner.net/download/prj/jsonxml/
答案 2 :(得分:0)
我解决了,但是用PHP
try {
seconds = gui.getSeconds() * 1000;
} catch (Exception e) {
}
while (!Thread.currentThread().isInterrupted()) {
robot.delay(seconds);
for (int i = 0; i < temp.length(); i++) {
typeThis(test[i]);
}
if (enter) {
typeNow(VK_ENTER);
}
}