This is my first attempt at a jQuery plugin. If someone could help me make sure that the code is clean, efficient, and formated correctly I would really appreciate it.BackgroundSo the reason I wrote this plugin is because I cannot find an easy to use code that has already been written. Plus, many people who work with a Learning Management System could utilize this without any effort on their part. All the communication with the LMS happens within the plugin, so they don't have to really learn the process of AICC communication. The only requirement to use this plugin is, the developer will have to know what AICC variables the LMS uses. These variables are set in stone by LMS and will not change per user ... everyone will have to use the same variables.LMS ProcessStep 1. User starts the course (a $.get() method is used to see if any information was previously stored. If so, load the information.)Step 2. As the user traverses the course you post information to the LMS and store the pages already viewed so you can have them start where they left off if they leave.(AKA Bookmarking)Step 3. After the user finishes the course you $.post() the information to the LMS and mark the course as passed.So the process is pretty straight forward, the only thing is the callback from the server is in straight text and that cannot be changed, so you are stuck using the format the LMS returns.What I am looking forWhat I would like is for everyone to look at the plug and see if its the best it could be and if not offer some type off feedback. This plugin works very good, but is it efficient?Here is my code, I will show the plugin code first then the HTMLjquery.aicc.js(function($){   $.extend({    aicc:function(p)    {                           var _sid      = getUrlVar('AICC_SID');        var _url      = getUrlVar('AICC_URL');        var _action   =(p['action']=='set')?setAICC(p['score'],p['time'],p['credit'],p['location'],p['status']):(p['action']=='get')?getAICC():false;                   function getUrlVar(urlVar)        {            var match = RegExp('[?&]' + urlVar + '=([^&]*)').exec(window.location.search);                  return unescape(match && decodeURIComponent(match[1].replace(/\+/g, ' ')));         }        function setAICC(s,t,c,l,ls,c)        {            $.post(_url,{command:PutParam,version:2.2,session_id:_sid, aicc_data:[CORE]\nlesson_location=+l+\ncredit=+c+\nscore=+s+\ntime=+t+\nlesson_status=+ls},function(r)            {                                   p['response'].call(this,json(r));            })            .error(function(a,b,c){p['response'].call(this,c);});        }        function getAICC()        {            $.get(_url,{command:GetParam,version:2.2,session_id:_sid},function(r)            {                p['response'].call(this,json(r));               })            .error(function(a,b,c){p['response'].call(this,c);});        }        function json(str)        {            var obj = {};                               str.replace(/([^=]+)=(.*)\n/g,function(_,name,value){obj[name]=value;});                return obj;        }    }}); })(jQuery);index.html<!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01//EN https://www.w3.org/TR/html4/transitional.dtd><html><head><meta http-equiv=Content-Type content=text/html; charset=iso-8859-1><title>jQuery Plugin Testing Portal</title><script language=javascript src=https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js></script><script language=javascript src=library/jquery.aicc.js></script><script type=text/javascript>$(function(){/* sets aicc information */$('#setBtn').click(function(){    $.aicc(    {        action:'set',        score:'83',        time:'00:00:00',        credit:'C',        location:'page_1',        status:'Incomplete',        response:function(r)        {            alert(r['ERROR']);            alert(r['ERROR_TEXT']);            alert(r['VERSION']);        }    });});/* gets ALL aicc information (returns in JSON format */$('#getBtn').click(function(){    $.aicc(    {        action:'get',        response:function(r)        {            alert(r['ERROR']);            alert(r['ERROR_TEXT']);            alert(r['VERSION']);            alert(r['AICC_DATA']);            alert(r['STUDENT_ID']);            alert(r['STUDENT_NAME']);            alert(r['SCORE']);            alert(r['TIME']);            alert(r['CREDIT']);            alert(r['LESSON_LOCATION']);            alert(r['LESSON_STATUS']);        }    });});});</script></head><body><button id=setBtn>Set AICC</button><button id=getBtn>Get AICC</button></body></html>Note: When the user is logged into the LMS and is taking the course, there are variables in the URL that the plugin grabs:http://www.lms.com/?AICC_SID=C0000000M00000S&AICC_URL=https%3a%2f%2fwww%2elms%2ecom%2fplateau%2fPwsAiccHere is the callback from the LMS on the $.post() and $.get(). (This is all text with each line ending with \n.)ERROR=0ERROR_TEXT=SuccessfulVERSION=2.2AICC_DATA=[CORE]STUDENT_ID=0123456STUDENT_NAME=Doe, John RSCORE=83TIME=02:35:37CREDIT=CLESSON_LOCATION=page_1LESSON_STATUS=INCOMPLETE[Core_Lesson][Objectives_Status]
Learning Management System/AICC project
javascript;jquery;html
I don't immediately see any efficiency issues with your code. It's simple and concise.But I do notice that you don't follow all the best practices for plugin authoring described here:http://docs.jquery.com/Plugins/AuthoringI guess you'll do something else than alerting ten times in production? ;)