开发者

Best approach to developing a cross-browser JavaScript widget that populates from a MySQL database?

开发者 https://www.devze.com 2023-02-05 22:20 出处:网络
I\'m currently researching the best way to approach building a JavaScript widget someone can embed on their site, which would retrieve and display information from an external MySQL database.

I'm currently researching the best way to approach building a JavaScript widget someone can embed on their site, which would retrieve and display information from an external MySQL database.

The gist of the widget would mimic the needs/functionality of Twitter's widget (http://twitter.com/about/resources/widgets), where it uses some combination of JavaScript, PHP and/or AJAX an开发者_高级运维d retrieves information from a MySQL database with secure (or at least somewhat safe) cross-browser access. Does anyone have thoughts or ideas on the best and most reliable way to approach something like this?


Here is a great guide to building a cross-domain widget: http://alexmarandon.com/articles/web_widget_jquery/

The hard part is the Javascript side; the server side can be written in PHP, or Python, or Ruby or whatever. Your google search should include the term "javascript widget" to get more articles like this one.


Should be simple. Encapsulate your widget entirely in a JS file if possible (minus images) and use AJAX for calling a REST or SOAP (probably want to stick to REST) webservice for any data access you need.


IFRAME, just use a iframe. you have

  • native sandbox
  • control over your environment
  • no updating your widget for your users if there is a new browser. You just update your code in your iframe.
  • Everyone uses this method ( Google+, Youtube, Facebook, Twitter )

its a win win situation.

0

精彩评论

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