搜索API在外部网站使用 [英] search api to use in external websites

查看:147
本文介绍了搜索API在外部网站使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来的API开发,所以不知道是否可行与否。

我有一个网站(<$ C C $> http://www.mysite.com/ )所组成的数据,我需要开发一个API或以某种方式使用本网站的数据,用它在另一网站。

我的要求是其他外部网站需要从我的主网站搜索数据( HTTP(http://www.externalwebsites.com ) ://www.mysite.com/ )。 http://www.externalwebsites.com/ 将发送搜索字符串 http://www.mysite.com/ ,它会发送回结果,并显示在 http://www.externalwebsites.com/

我需要使用 http://www.externalwebsites.com/ Ajax调用搜索数据,所以我的问题是

  1. 在这整个过程中是否可行?
解决方案

当然,你可以使用JSONP,默认情况下,库,比如jQuery的支持。

http://docs.jquery.com/Release:jQuery_1.2/Ajax#Cross-Domain_getJSON_.28using_JSONP.29

I am new to api development, so don't know whether this is feasible or not.

I have a website(http://www.mysite.com/) which consists of data and i need to develop an api or somehow use this site's data to use it in another websites.

My requirement is other external websites(http://www.externalwebsites.com) need to search the data from my main site (http://www.mysite.com/). http://www.externalwebsites.com/ will send search string to http://www.mysite.com/ and it will send back result and show them in http://www.externalwebsites.com/.

i need to use ajax calls in http://www.externalwebsites.com/ for searching data, so my question is

  1. Is this whole process feasible ?

解决方案

Sure, you can use JSONP, supported by default in libraries like jQuery.

http://docs.jquery.com/Release:jQuery_1.2/Ajax#Cross-Domain_getJSON_.28using_JSONP.29

这篇关于搜索API在外部网站使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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