Link to home
Start Free TrialLog in
Avatar of TechTremor
TechTremor

asked on

Best Practice for Javascript API Building

Looking at many services they are putting javascript files on your page which ends up generating the content in the form of forms, linkbacks, buttons, ads, ect.

To keep it simple lets say I wanted to create a button that users could click on any site and it would post back to a database on my main site and tell the DB what page they clicked. Kind of like dig.

I'm assuming most use JSON or similar to post the data back. However, how should the JS file be constructed that would generate the button on the site?

I haven't found any best practices or best ways to go about doing this.

Best Regards.
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Hello TechTremor,

Not sure I understand your need but have a look to this artice : http://wiki.apache.org/struts/AjaxStruts

Regards.
Avatar of TechTremor
TechTremor

ASKER

That explains a bit of the Ajax side, let me try to explain a bit better.

I would like to write some javascript that i could be included on any page on the web via:

<script language="javascript" src="site.com/jsfile.js">

This script would generate a button that could be clicked to send back URL destination to the host site (in this case site.com) server.

My question is whats the best practice to get the jsfile.js to generate a usable button on any site the js file is put on.



<script language="javascript" src="http://www.antonspaans.com/mysmugmug.js">

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for the points!