开发者

Using Cross Domain Ajax to search?

I realize that the same origin 开发者_JAVA技巧policy would normally make this impossible, but I'm trying to create a simple search script using the jquery.crossdomainajax.js

Say I have randomwebsite.com. I want that website to be able to run a script that will search another site on a different server for a single word. For instance, I would want my randomwebsite.com to search espn.com for "Yankees" and then I would like it to alert me as to whether that word was found on the foreign domain site.

Is this possible? I appreciate all the help you guys can offer!


No it's not possible. Cross site ajax works by including the other site as script.


I don't know of a way to do this with client-side Javascript only.

One way to solve this problem is to have a server that can do the searching for you and return the results to you via an ajax call. So, your webpage on randomwebsite.com would issue an ajax call so your randomwebsite.com server. That server would search espn.com for the word and return the results back to you in the ajax call. Your server would have none of the same origin limitations.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜