获取 Yahoo Pipes 脚本的用户输入

发布于 2024-10-27 05:16:03 字数 606 浏览 5 评论 0原文

我对这方面有点菜鸟,所以我想知道是否有人可以帮助解决我希望是一个简单的问题。

我开发了一个雅虎管道,它将标签的名称作为输入。然后应该运行 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

柏拉图鍀咏恒 2024-11-03 05:16:03

如果您使用服务器端脚本,则这是一个由三部分组成的技巧

信息从常规表单发送回其来源页面,并从 url 中提取,如下所示

enter <?php $userInput    = $_GET["userInput"]); ?>here

现在可以将 userInput 写入 javascript src URL 中,从而使交叉对管道的域调用。

enter <script src="http://pipes.yahoo.com/pipes/pipe.run?_id=050fc8ccfefd18420680a86ebf4bf80e&_render=json&_callback=cbfunc&town=<?php echo $userInput; ?>"></script> here

当管道返回数据时,它会在其周围包裹一个“回调”标记,在本例中称为 cbfunc,这用于触发页面头部中提取的 JavaScript 例程数据 JSON 字符串,以便您可以用它执行您想要的操作。

enter function cbfunc(data){
    var data     = (data.value.items[0].content)
                } here

您可以在 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

enter <?php $userInput    = $_GET["userInput"]); ?>here

Now the userInput can be written into a javascript src URL that makes the cross domain call to the pipe.

enter <script src="http://pipes.yahoo.com/pipes/pipe.run?_id=050fc8ccfefd18420680a86ebf4bf80e&_render=json&_callback=cbfunc&town=<?php echo $userInput; ?>"></script> here

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.

enter function cbfunc(data){
    var data     = (data.value.items[0].content)
                } here

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/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文