获取 Yahoo Pipes 脚本的用户输入
我对这方面有点菜鸟,所以我想知道是否有人可以帮助解决我希望是一个简单的问题。
我开发了一个雅虎管道,它将标签的名称作为输入。然后应该运行 yahoo 管道来生成输出。
下面是我从 Yahoo Pipes 页面运行 Yahoo Pipe 时生成的代码片段。
现在我的问题是我想从我自己的站点运行此管道并让用户输入他们想要的标签,而不是让他们离开站点并转到 Yahoo Pipes 页面。
<script src="http://l.yimg.com/a/i/us/pps/listbadge_1.4.js">{"pipe_id":"6c3a35f3d8e3cdb8ef270a3565d64ca3","_btype":"list","pipe_params":{"tags":"Cooking Beef Chicken"},"width":"600","height":"500"}</script>
我想要一个简单的表单供用户填写,并让代码从他们的输入生成上述脚本代码并执行。
我希望我已经解释了这一点,因为它有点令人困惑。
总而言之,如何从网页上的用户获取有关他们想要针对哪些标签运行管道的输入,并使其生成正确的代码并执行。
I'm a bit of a noob at some of this so I was wondering if someone could help with what I hope is a simple question.
I've developed a Yahoo Pipe that takes as Input the name of a Label(s). This then should run the yahoo pipe to generate the output.
Below is a snippet of code that is generated when I run the the Yahoo Pipe from the Yahoo Pipes page.
Now my question is I want to run this pipe from my own site and get the user to Input the labels they want rather than having them leave the site and go to the Yahoo Pipes page.
<script src="http://l.yimg.com/a/i/us/pps/listbadge_1.4.js">{"pipe_id":"6c3a35f3d8e3cdb8ef270a3565d64ca3","_btype":"list","pipe_params":{"tags":"Cooking Beef Chicken"},"width":"600","height":"500"}</script>
I'd like to have a simple Form that the user fills out and for the code to generate the above script code from their input and execute.
I hope I've explained this as it's a little confusing.
To sum up, how do I get input from a user on a web page about which Labels they want to run the pipe against and for it to generate the correct code and execute.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您使用服务器端脚本,则这是一个由三部分组成的技巧
信息从常规表单发送回其来源页面,并从 url 中提取,如下所示
现在可以将 userInput 写入 javascript src URL 中,从而使交叉对管道的域调用。
当管道返回数据时,它会在其周围包裹一个“回调”标记,在本例中称为 cbfunc,这用于触发页面头部中提取的 JavaScript 例程数据 JSON 字符串,以便您可以用它执行您想要的操作。
您可以在 http://bishop-test.appspot.com/ 当您点击地图搜索时。此链接对于检查 JSON 输出也很有帮助 http://braincast.nl/samples/jsoneditor/
It's a three part trick if you use a server side script
Information is sent from a regular form back to the page it comes from and that is extracted from the url like so
Now the userInput can be written into a javascript src URL that makes the cross domain call to the pipe.
When the pipe returns the data it wraps a 'callback' tag around it, in this case called cbfunc and this is used to trigger a javascript routine in the page head that extracts data the JSON string for you to do what you want with it.
You can see a working example of this in action at http://bishop-test.appspot.com/ when you click on the map search. This link is also helpful for examaning the JSON output http://braincast.nl/samples/jsoneditor/