jQuery的自动完成 - XML跨站点请求 [英] jQuery autocomplete - xml cross site request

查看:256
本文介绍了jQuery的自动完成 - XML跨站点请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我自动完成的XML饲料是另一台服务器上。有没有得到这个XML文档的客户端(JavaScript)的方法?

我知道我可以创建一个代理与PHP,JSP等。但我需要做的所有客户端。这就是我现在如何调用该文件,只有工作,如果是同一个域:

 函数callAjax(URL){
  $阿贾克斯({
        网址:网址,
        数据类型:XML,
        成功:函数(xmlResponse){
              totalrec = $(TOTALREC,xmlResponse)的.text();
            $ .merge(数据1,$(行,xmlResponse).MAP(returnResults)获得());
        } //成功结束
  });


解决方案

YQL也许可以做你想做的。它可以让你做跨域请求。

有一个看看这个:用jQuery <跨域请求/ A>

H.T.H

The XML feed for my autocomplete is on another server. Is there a client side (javascript) method of getting this XML document?

I know I can create a proxy with php, jsp, etc.. but I need to do it all client side. This is how I call the file now that only works if it is on the same domain:

function callAjax(url) {
  $.ajax({
        url : url,
        dataType : "xml",
        success : function(xmlResponse) {
              totalrec = $("TOTALREC", xmlResponse).text();
            $.merge(data1, $("ROW", xmlResponse).map(returnResults).get());
        }// end of success
  });

解决方案

YQL might be able to do what you want. It allows you to do cross-domain requests.

Have a look at this: Cross-domain requests with jQuery

H.T.H

这篇关于jQuery的自动完成 - XML跨站点请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆