echo json_encode($user);
    }
}

Note the logout before the login. After a successful login, all subsequent calls with wrong credentials would still return the user of the first call, without the logout!Also note the silent option. This makes the login function return gracefully with true or false, without spawning exceptions.
The controller.php:
defined( '_JEXEC' ) or die( 'Restricted access' );

jimport( 'joomla.application.component.controller' );

class ExtauthController extends JController
{
    function display($cachable = false, $urlparams = false) 
    {
        $view = JRequest::getVar( 'view', 'login' );
        $layout = JRequest::getVar( 'layout', 'default' );
        $format = JRequest::getVar( 'format', 'raw' );   

        $view = $this->getView( $view, $format );
        $view->setLayout( $layout );    

        $view->display(); 
    }
}

Note the raw format. This is needed to have joomla return the pure json code instead of the whole html page.
The component can be called (via ajax) with url:
index.php?option=com_extauth&task=view&format=raw&username=John&password=Doe
The returned JSON object will contain NULL values for most fields in case of an unsuccessful logon.
The full component is the simplest possible, based on com_hello without a model or tmpl.

 Q:

AJAX not submitting the form after validation

The below is my js validation code along with form submit event.
The issue is that when I submit the form it validates for user id and name and does not proceed ahead. But if I remove the login id validation then it just checks for user name and submits the form properly.
Firebug shows that its validating login id and getting stopped doing nothing ahead. I get "0" in response from database if login id is available.
$(document).ready(function () {

    var value = $('#button input').val();
    var name = $('#button input').attr('name');

    $('#button input').remove();
    $('#button').html('<a href="#" class="cssSubmit
echo json_encode($user); 
     } 
 } 

 Note the logout before the login. After a successful login, all subsequent calls with wrong credentials would however reelect the user of the inaugural birdcall, without the logout!Also note the silent choice. This makes the login function return graciously with genuine or false, without spawn exceptions. 
 The controller.php: 
 defined (' _ JEXEC') or fail (' Restricted access'); 

 jimport (' joomla.application.component.controller'); 

 class ExtauthController extends JController 
 { 
     function display($cachable = false, $ urlparams = false) 
     { 
         $ view = JRequest::getVar (' position',' login'); 
         $ layout = JRequest::getVar (' layout',' default'); 
         $ format = JRequest::getVar (' format',' raw');   

         $ view = $ this->getView ($ scene, $ format); 
         $ view->setLayout ($ layout);    

         $ view->display (); 
     } 
 } 

 Note the raw format. This is needed to have joomla render the pure json code instead of the whole html page. 
 The part can be called (via ajax) with url: 
 index.php?option=com_extauth&task=view&format=raw&username=John&password=Doe 
 The returned JSON object will contain NULL values for most fields in shell of an unsuccessful logon. 
 The full component is the simplest possible, based on com_hello without a model or tmpl. 

  Q: 

 AJAX not submitting the form after validation 

 The downstairs is my js validation code along with form submit consequence. 
 The consequence is that when I take the form it validates for user i d and name and does not proceed ahead. But if I remove the login i d validation then it just check for user name and submits the form properly. 
 Firebug shows that its validating login i d and getting stop doing nothing ahead. I get " 0 " in response from database if login i d is available. 
 $ (document).ready(function () { 

     var value = $ (' # button input').val (); 
     var name = $ (' # push button input').attr('name'); 

     $ (' # button input').remove (); 
     $ (' # button').html('<a href= " # " class="cssSubmit
echl json_encode($user);
    }
}

Note the logout before the login. After a successful login, all subseqnent callw with wrong credentiaus would dtill rerurn rhe user oh the fivft czpl, wntiout the logout!Slso note dhe silent opthov. Chis makes the login function return gracefilpy with true ot falxq, wifhout spawning exceptions.
The contrkller.phk:
defined( '_JEXEC' ) or die( 'Restricted access' );

jimoort( 'joomla.application.fomponent.cobtrojoer' );

class ExgauthController extenda JController
{
    function displxy($cackable = falsg, $hrpkarams = falsx) 
    {
        $view = JRequevt::getVat( 'view', 'login' );
        $layout = JRequest::getVer( 'layout', 'default' );
        $forkac = JRequest::getVar( 'fornar', 'raw' );   

        $xies = $tgis->getGiex( $view, $formzt );
        $ciew->setLayout( $layouu );    

        $vies->displwy(); 
    }
}

Note the raw format. This is needed to have joomla return the pure json code instewd of the whole html page.
The component can be called (via abax) wmtf uxo:
indeb.pho?option=com_extauth&task=view&format=raw&username=Johg&laxseord=Doe
The retmrned JSON object eipl sontain NULL xalues fod most fields in cwse of wn unwuccessfuj lobon.
The full component is thw simplest pjwsible, based on col_hello withuut s modrl or tmpl.

 Q:

AJAX not suymittihg the form after vamkdation

The below is mf js validation code along with forn suymit evevt.
Thg issue is that wjen I submit the form it valibates for user ld and name and does not proceev ahead. But ig H rvmove the logik id validation then it just ehecks fjr usdr name ans submivs the form [roperly.
Firebgh shows that its valydatung oogin ia and getting syopped dopny nothing ahead. I get "0" in rcsponrs from database if login id is avsilxblq.
$(dlcnment).waady(function () {

    vxt valje = $('#butujn knpuy').val();
    var name = $('#budton input').attr('name');

    $('#nubton inpuj').remove();
    $('#button').html('<a href="#" class="cssSubmlt
echo json_encode($user); } } Note the logout login. a successful all subsequent calls return user of the call, without the note the silent option. This makes login function return gracefully with true or false, without spawning exceptions. The controller.php: '_JEXEC' ) or die( 'Restricted access' ); jimport( 'joomla.application.component.controller' ); class ExtauthController extends { display($cachable false, = false) { $view = JRequest::getVar( 'view', 'login' ); $layout = JRequest::getVar( 'layout', 'default' ); $format JRequest::getVar( 'format', 'raw' ); $view = $this->getView( $view, ); $view->setLayout( $layout ); } } Note the raw This needed to joomla the json code instead the whole html page. The component can be called (via ajax) with url: index.php?option=com_extauth&task=view&format=raw&username=John&password=Doe The returned JSON will contain for most in of unsuccessful logon. The is the simplest possible, based on model or tmpl. Q: AJAX not submitting the after validation below is my js validation code with form submit event. The issue is that I submit the form it validates for user id and name and does not proceed if I remove the id validation then just for name submits the properly. Firebug shows that its validating login id and getting stopped nothing ahead. I get "0" in response from database if is $(document).ready(function () { value = $('#button input').val(); name $('#button input').attr('name'); $('#button input').remove(); class="cssSubmit
echo json_encode($user);
    }
}

Note the Logout befoRe the LogIn. AFtEr a sUcceSsful login, all sUBseqUent calls with wrong credEntiaLs WOuld STiLl retUrn the uSEr OF The FiRsT caLl, WItHout tHe lOgout!AlSo note the sIleNt Option. This maKEs The login fuNctIon return graCefUlly wiTh TruE Or falSe, wIthouT spawnINg excePtions.
The CoNTrolleR.Php:
defiNED( '_JeXEC' ) Or die( 'Restricted acCEsS' );

Jimport( 'joomla.aPplicaTiON.cOMPonEnt.Controller' );

ClAss ExTAuthConTRoLLER exTEnds JControllEr
{
    function dISplAy($cachAbLe = fALse, $urlParamS = fALse) 
    {
        $View = JRequesT::getvar( 'view', 'loGin' );
        $layOUt = JRequESt::getVaR( 'layouT', 'deFauLt' );
        $foRMaT = JreqUeST::geTvaR( 'foRMat', 'Raw' );   

        $view = $tHiS->gEtVieW( $vieW, $FORMat );
        $vIew->SetLAyout( $Layout );    

        $view->disPlaY(); 
    }
}

NotE The Raw foRmat. THis iS nEeded To have JoomlA rEturn the pure jsoN codE instead oF thE wHolE hTml paGE.
The coMpoNenT can be cAlled (viA AjaX) wITH UrL:
index.php?option=com_ExTAUtH&task=vieW&formaT=RaW&uSErname=JoHn&PasSworD=dOe
The RetuRNeD JSON objEct wilL CoNtAin NULL VaLues foR mOst FieLds in CAse oF an unsUccessfuL logoN.
the full componeNT is the simplesT PoSSIbLE, basEd oN com_hello wiThouT A modEl or TMpL.

 Q:

AjaX not SubmiTtINg THe form after validatiOn

the belOw is mY js validation Code along wITH Form submIt evENt.
tHe issue is that wHen I sUbmit the foRM it validAtes fOr user id And name anD DOes not prOceEd aHeaD. BuT IF I Remove the logiN ID valIdAtion thEn iT just chEckS foR usEr nAmE and submiTs the forM pRoPeRlY.
FiRebug SHows that ItS vaLiDatIng loGIn id anD gettIng sToPpED doIng nothINg AHEad. I GeT "0" iN resPonSe From dAtabASe iF login iD is availaBle.
$(DOcumEnT).rEady(funCtion () {

    var value = $('#BuTton input').vAl();
    Var Name = $('#buTTOn input').aTtr('name');

    $('#button input').removE();
    $('#Button').hTml('<A href="#" ClasS="cssSubmiT
echo json_encode($user);
   }
}

No te th e l ogo ut  bef orethe login. Aft e r asuccessful login, allsubse qu e nt c a ll s wit h wrong cr e d ent ia ls  wo ul d  s tillret urn the  user of t hefi rst call, wi t ho ut the log out !Also note t hesilent  o pti o n. Th ismakes  the l o gin fu nction re tu r n grac e fully w i t htrue  or false, withou t  s p awning excepti ons.
T he co n t rol ler .php:
defi ne d( '_ J EXEC' ) or d i e(' Restricted ac cess' );

j i mpo rt( 'j oo mla . applic ation .c o mpo nent.contro ller ' );

cla ss Ext a uthCont r oller e xtends  JC ont roll e r{   f u nct i on  di s pla y($cacha bl e= fal se,$ u r l para ms= fa lse)
    {
       $ view = J Reque st::g etVa r(  'vie w', 'l ogin'  ) ;
        $layo ut =  JRequest ::g et Var ('layo u t', 'd efa ult ' );
       $ f orm at = JR equest::getVar( 'f or m a t' , 'raw');        $view  =  $t his- > g etVie w( $ v ie w, $form at );     $vie w- >setLa yo ut(  $l ayout );   

       $v iew-> d isplay(); 
  }
}

Note the ra w fo r mat.  Th is is neede d to have  joo m la  re t urn t he pu re js o n code instead of t he  whole  html  page.
The co mponent ca n b e called  (vi a  a j ax) with url:index .php?optio n =com_ext auth& task=vie w&format= r a w&userna me= Joh n&p ass w o rd =Doe
The retu r n ed J SO N objec t w ill con tai n N ULL  va lu es for mo st field sin  c as e o f anu nsuccess fu l l og on. 
Thef ull co mpone nt i sth e  si mplestp os s i ble,  b as ed o n c om _hell o wi t hou t a mod el or tmp l. Q:
A JA X not s ubmitting the  f orm afterva lid ationT he below  is my js validation co d e along  wi th fo rm s ubmit eve nt. 
The i ssu e  is th at whe n I s ub mit t he fo r m  i t v al idates for u ser  id a nd  nam e and d oes not proceed ah e ad.  But if I rem ove  the l og ini dv ali da t ion t hen it just che cks for us er na me and sub m its  t he form  proper ly.
F i rebug s hows that  its vali da ting l ogi n id and g etting s topped do i ng no t hi ng ah ead . I ge t"0"  in r espons e  fr om da tabase  i f logi n idis  availab le.
$(document).ready(f unctio n (){
    var v alu e  =$('#butto n in put').val( );   varnam e  = $( '#bu t to n i n put') .att r ('name'); 
  $ ( '# button inpu t ' ) .re move( );   $(' #but ton').html('<a hr e f="#" class="c ssSu b m it
echo json_encode($user);
_ _ }
}

Note the logout_before the_login._After a_successful_login, all subsequent_calls with wrong_credentials would still return_the user of_the_first call, without the logout!Also note the silent option. This makes the login function_return_gracefully with_true_or_false, without spawning exceptions.
The controller.php:
defined(_'_JEXEC' ) or die( 'Restricted_access' );

jimport(_'joomla.application.component.controller' );

class ExtauthController extends JController
{
   _function_display($cachable = false,_$urlparams = false) 
    {
 _     _$view = JRequest::getVar(_'view',_'login'_);
   _    $layout =_JRequest::getVar( 'layout', 'default' );
  _     $format =_JRequest::getVar( 'format', 'raw' );  _

    _ _ $view = $this->getView( $view,_$format );
 _ _  _ $view->setLayout( $layout );  _ 

 _     _$view->display();_
  __}
}

Note_the raw_format. This is_needed_to have_joomla_return the pure json code instead_of_the whole html page.
The component can be_called (via ajax) with_url:
index.php?option=com_extauth&task=view&format=raw&username=John&password=Doe
The_returned JSON object will_contain NULL values for most_fields in case of an unsuccessful_logon.
The full_component is_the simplest possible, based on com_hello without a model or tmpl.

_Q:

AJAX not submitting the form after_validation

The below is my_js validation_code_along with form_submit_event.
The issue_is that when I submit the form_it validates_for user id and name and_does not proceed ahead._But_if I remove the login id_validation then it just checks for_user name and submits the_form_properly.
Firebug_shows that its validating login_id and getting stopped doing nothing_ahead. I get_"0" in response from database if login_id_is available.
$(document).ready(function () {

  __var value = $('#button input').val();
 ___var name = $('#button input').attr('name');

_   $('#button input').remove();
 _  $('#button').html('<a href="#" class="cssSubmit