解析xml现在给了我一个错误

时间:2022-10-07 00:18:51

here is my ajax call

这是我的ajax电话

$j.ajax({
  url: "http://www.earthtools.org/timezone/40.71417/-74.00639",
  dataType: "jsonp",
  complete: function(data){
    console.log(data);
  }
});

the url returns back xml but I need to use jsonp to avoid cross site scripting....any ideas on how to avoid this error

url返回xml但我需要使用jsonp来避免跨站脚本....关于如何避免这个错误的任何想法

missing ; before statement
[Break On This Error]   

<timezone xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceS...

-74.00...7653717 (line 2, col 10)

Any ideas...i need the localtime out of this call

任何想法…我需要这个电话的本地时间

1 个解决方案

#1


1  

you can not get xml cross domain in javascript due to cross domain policies...there are 100's of similar threads on SO

由于跨域策略,您无法在javascript中获得xml跨域。有100个类似的线程

You can use a proxy if API doesn't deliver jsonp. Another handy tool is Yahoo YQL. They have a sandbox console can set your url up in minutes and get a YQL url to get data from in choice of xml or jsonp

如果API不交付jsonp,您可以使用代理。另一个方便的工具是Yahoo YQL。他们有一个沙箱控制台,可以在几分钟内设置url并获得一个YQL url,以便从xml或jsonp中获取数据

#1


1  

you can not get xml cross domain in javascript due to cross domain policies...there are 100's of similar threads on SO

由于跨域策略,您无法在javascript中获得xml跨域。有100个类似的线程

You can use a proxy if API doesn't deliver jsonp. Another handy tool is Yahoo YQL. They have a sandbox console can set your url up in minutes and get a YQL url to get data from in choice of xml or jsonp

如果API不交付jsonp,您可以使用代理。另一个方便的工具是Yahoo YQL。他们有一个沙箱控制台,可以在几分钟内设置url并获得一个YQL url,以便从xml或jsonp中获取数据