English 中文(简体)
使用 JS 滑动器显示电子商店 API 产品的嵌入部件
原标题:Embeddable widget showing products from a e-shop API using JS slider

我需要开发一个嵌入式部件, 它必须看起来像这样:

    <div id="my_widget" data-api_key="xxx" data-shop_id="xxx"></div>
    <script type="text/javascript" src="my_widget.js"></script>

API 要求必须在PHP中执行。 我必须在 id < code> data-shop_id 中为商店展示另外三种销售产品 。

我同意 PHP 的编码, 我的问题是如何执行我的 _widget.js 以及如何将它与 jQuery 滑块集成。 我如何使用 PHP 中的数据- api_ key 和数据- shop_ id 标签?

使用 或者更纯洁的 JavaScript 是否可行?

抱歉, 如果听起来有点混乱, 我还在想如何操作。 如果您知道如何使用 PHP + JavaScript 来执行部件, 我会很高兴 。

问题回答

我认为最简单的方法就是使用一个框架。

尽管您可以使用 jQuery 来张贴数据商店id, 然后作为 JSON 接收结果并进行处理 。

jQuery 访问数据属性 - $( 此) 。 data ("shop_ id")





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签