You can browse the JavaScript apis provided by LuCI here. A good starting point is the central luci.js class.