AJAX和NS_ERROR_DOM_BAD_URI错误 [英] AJAX and NS_ERROR_DOM_BAD_URI error

查看:173
本文介绍了AJAX和NS_ERROR_DOM_BAD_URI错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直有以下的问题,我认为这可能是由于这样的事实,我的方法可能是错误的,但我希望在您的帮助,我可以排序了这一点!

I have been having the following problem, i think it's probably due to the fact that my approach may be misguided, but hopefully with your help i can sort this out!

基本上,我的地盘我有一个搜索服务提供商(谁已经支付,所以我没有违反使用任何计算)。当搜索表单subbmitted我针对其中显示结果的域。

Basically, for my site i have a search provider (who has been paid, so i am not breaking any terms of use). When the search form is subbmitted i am directed to their domain where the results are displayed.

虽然我可以自定义返回的结果看,只有到目前为止,我可以利用这一点,将永远不会得到它的装修完全与我的网站的外观和感觉。

Whilst i can customise the look of the returned results, there is only so far i can take this, and will never get it fitting in fully with the look and feel of my site.

所以,我想,而不是通过形式做正规得到的,我会做一个支持Ajax GET,然后注入返回的响应到页面上一个div - 让我保持的外观和感觉,并永远不会离开我们的领域

So, i thought, instead of doing the regular GET via the form, i would do an AJAXified GET and then inject the returned response into a div on the page - allowing me to maintain the look and feel and never leave our domain.

这工作正常,但在IE在Firefox我得到的text / html(NS_ERROR_DOM_BAD_URI)是一个错误。已经做了一些研究,我已经发现,这是由于AJAX请求打我们的领域之外的网站。

This works fine in IE but in firefox i get "text/html (NS_ERROR_DOM_BAD_URI)" as an error. Having done some research i have discovered this is due to the AJAX request hitting a site outside of our domain.

因此​​,有没有更好的方法,我可以达到同样的效果呢?或者是有办法可以让Firefox和我的AJAX请求发挥好?什么是真正奇怪的是,如果我观察,在HttpFox(一个整洁的FF上添加)的要求,它报告上述错误,但看内容返回不出所料都在那里 - 为什么我不能访问它! !

Thus, is there a better approach i can take to achieve the same effect? or is there a way i can get firefox and my AJAX request to play nice? What is really strange is that if i observe the request in the HttpFox (a neat FF add on), it reports the above error, but looking at the content returned it is all there as expected - so why can't i access it!!

我真的很想得到这个工作,因为它是不是重写所有的CSS和东西得到他们的结果页面看就像我们的网站简单了一大堆。任何帮助在这方面将是非常美联社preciated。

I would really like to get this to work as it is a whole lot simpler than rewriting all our CSS and stuff to get their results page looking almost like our site. Any help in this area would be much appreciated.

推荐答案

您将不得不使用JSONP做跨域据我所知 - 它在AJAX安全异常。 JQuery的处理它很好,但是,你必须有修改,以符合它的服务器的回复。

You'll have to use JSONP to do cross domain as far as I know - it's a security exception in AJAX. JQuery handles it nicely but, you will have to have the server reply modified to match it.

我已经做了一个开放源码软件项目的社会行动这个使用PHP代理,做。你可以看一下在这里: http://os.adamaltemus.com/social-actions/

I have done an OSS project for Social Actions that does this using a PHP proxy. You can look at it here: http://os.adamaltemus.com/social-actions/

这篇关于AJAX和NS_ERROR_DOM_BAD_URI错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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