私はjQueryを学び、自分のサイトのajax認証を作成します。 jQueryは素晴らしいフレームワークです。 私はjavascriptを理解しておらず、ajax認証を書くことができるとは考えられません。 このような素晴らしい奇跡のjQueryに感謝します!
以下に認証コードを示しました。 一般に、すべてが正常に機能しますが、ユーザーがログインした後、「終了」リンクをクリックしてもloginoutイベントは発生せず、ページをリロードすると機能します。 ユーザーがログアウトした後も同じこと-ページをリロードしないと、ユーザーはログインできなくなります。 たぶん誰かがあなたに問題を解決する方法を教えてくれるでしょうか?
また、コードに対するコメントとコメントにも感謝します。
$( document ).ready( function (){ //ajax login $( "#loginform" ).bind( "submit" , function () { var qString = $( '#loginform' ).formSerialize(); $.getJSON( 'login.html' , qString, function (json){ if (json.result == 1){ $( '#login' ).html( '' ); $( '#login' ).append( '<a href=profile.html?id=' + json.id + '>' + json.login + '</a> <a id="logout" href=""></a>' ); $( "#logout" ).bind( "click" , function () { $( '#login' ).load( "logout.html" );; return false ; }); } else { $( '#msg' ).html( '' ); $( '#msg' ).append( ' ' ); } }); return false ; }); //end ajax login //ajax logout $( "#logout" ).bind( "click" , function () { $( '#login' ).load( "logout.html" ); return false ; }); //end ajax logout }); //end document .ready * This source code was highlighted with Source Code Highlighter .
$( document ).ready( function (){ //ajax login $( "#loginform" ).bind( "submit" , function () { var qString = $( '#loginform' ).formSerialize(); $.getJSON( 'login.html' , qString, function (json){ if (json.result == 1){ $( '#login' ).html( '' ); $( '#login' ).append( '<a href=profile.html?id=' + json.id + '>' + json.login + '</a> <a id="logout" href=""></a>' ); $( "#logout" ).bind( "click" , function () { $( '#login' ).load( "logout.html" );; return false ; }); } else { $( '#msg' ).html( '' ); $( '#msg' ).append( ' ' ); } }); return false ; }); //end ajax login //ajax logout $( "#logout" ).bind( "click" , function () { $( '#login' ).load( "logout.html" ); return false ; }); //end ajax logout }); //end document .ready * This source code was highlighted with Source Code Highlighter .
$( document ).ready( function (){ //ajax login $( "#loginform" ).bind( "submit" , function () { var qString = $( '#loginform' ).formSerialize(); $.getJSON( 'login.html' , qString, function (json){ if (json.result == 1){ $( '#login' ).html( '' ); $( '#login' ).append( '<a href=profile.html?id=' + json.id + '>' + json.login + '</a> <a id="logout" href=""></a>' ); $( "#logout" ).bind( "click" , function () { $( '#login' ).load( "logout.html" );; return false ; }); } else { $( '#msg' ).html( '' ); $( '#msg' ).append( ' ' ); } }); return false ; }); //end ajax login //ajax logout $( "#logout" ).bind( "click" , function () { $( '#login' ).load( "logout.html" ); return false ; }); //end ajax logout }); //end document .ready * This source code was highlighted with Source Code Highlighter .
$( document ).ready( function (){ //ajax login $( "#loginform" ).bind( "submit" , function () { var qString = $( '#loginform' ).formSerialize(); $.getJSON( 'login.html' , qString, function (json){ if (json.result == 1){ $( '#login' ).html( '' ); $( '#login' ).append( '<a href=profile.html?id=' + json.id + '>' + json.login + '</a> <a id="logout" href=""></a>' ); $( "#logout" ).bind( "click" , function () { $( '#login' ).load( "logout.html" );; return false ; }); } else { $( '#msg' ).html( '' ); $( '#msg' ).append( ' ' ); } }); return false ; }); //end ajax login //ajax logout $( "#logout" ).bind( "click" , function () { $( '#login' ).load( "logout.html" ); return false ; }); //end ajax logout }); //end document .ready * This source code was highlighted with Source Code Highlighter .
$( document ).ready( function (){ //ajax login $( "#loginform" ).bind( "submit" , function () { var qString = $( '#loginform' ).formSerialize(); $.getJSON( 'login.html' , qString, function (json){ if (json.result == 1){ $( '#login' ).html( '' ); $( '#login' ).append( '<a href=profile.html?id=' + json.id + '>' + json.login + '</a> <a id="logout" href=""></a>' ); $( "#logout" ).bind( "click" , function () { $( '#login' ).load( "logout.html" );; return false ; }); } else { $( '#msg' ).html( '' ); $( '#msg' ).append( ' ' ); } }); return false ; }); //end ajax login //ajax logout $( "#logout" ).bind( "click" , function () { $( '#login' ).load( "logout.html" ); return false ; }); //end ajax logout }); //end document .ready * This source code was highlighted with Source Code Highlighter .
$( document ).ready( function (){ //ajax login $( "#loginform" ).bind( "submit" , function () { var qString = $( '#loginform' ).formSerialize(); $.getJSON( 'login.html' , qString, function (json){ if (json.result == 1){ $( '#login' ).html( '' ); $( '#login' ).append( '<a href=profile.html?id=' + json.id + '>' + json.login + '</a> <a id="logout" href=""></a>' ); $( "#logout" ).bind( "click" , function () { $( '#login' ).load( "logout.html" );; return false ; }); } else { $( '#msg' ).html( '' ); $( '#msg' ).append( ' ' ); } }); return false ; }); //end ajax login //ajax logout $( "#logout" ).bind( "click" , function () { $( '#login' ).load( "logout.html" ); return false ; }); //end ajax logout }); //end document .ready * This source code was highlighted with Source Code Highlighter .
$( document ).ready( function (){ //ajax login $( "#loginform" ).bind( "submit" , function () { var qString = $( '#loginform' ).formSerialize(); $.getJSON( 'login.html' , qString, function (json){ if (json.result == 1){ $( '#login' ).html( '' ); $( '#login' ).append( '<a href=profile.html?id=' + json.id + '>' + json.login + '</a> <a id="logout" href=""></a>' ); $( "#logout" ).bind( "click" , function () { $( '#login' ).load( "logout.html" );; return false ; }); } else { $( '#msg' ).html( '' ); $( '#msg' ).append( ' ' ); } }); return false ; }); //end ajax login //ajax logout $( "#logout" ).bind( "click" , function () { $( '#login' ).load( "logout.html" ); return false ; }); //end ajax logout }); //end document .ready * This source code was highlighted with Source Code Highlighter .
$( document ).ready( function (){ //ajax login $( "#loginform" ).bind( "submit" , function () { var qString = $( '#loginform' ).formSerialize(); $.getJSON( 'login.html' , qString, function (json){ if (json.result == 1){ $( '#login' ).html( '' ); $( '#login' ).append( '<a href=profile.html?id=' + json.id + '>' + json.login + '</a> <a id="logout" href=""></a>' ); $( "#logout" ).bind( "click" , function () { $( '#login' ).load( "logout.html" );; return false ; }); } else { $( '#msg' ).html( '' ); $( '#msg' ).append( ' ' ); } }); return false ; }); //end ajax login //ajax logout $( "#logout" ).bind( "click" , function () { $( '#login' ).load( "logout.html" ); return false ; }); //end ajax logout }); //end document .ready * This source code was highlighted with Source Code Highlighter .
$( document ).ready( function (){ //ajax login $( "#loginform" ).bind( "submit" , function () { var qString = $( '#loginform' ).formSerialize(); $.getJSON( 'login.html' , qString, function (json){ if (json.result == 1){ $( '#login' ).html( '' ); $( '#login' ).append( '<a href=profile.html?id=' + json.id + '>' + json.login + '</a> <a id="logout" href=""></a>' ); $( "#logout" ).bind( "click" , function () { $( '#login' ).load( "logout.html" );; return false ; }); } else { $( '#msg' ).html( '' ); $( '#msg' ).append( ' ' ); } }); return false ; }); //end ajax login //ajax logout $( "#logout" ).bind( "click" , function () { $( '#login' ).load( "logout.html" ); return false ; }); //end ajax logout }); //end document .ready * This source code was highlighted with Source Code Highlighter .
$( document ).ready( function (){ //ajax login $( "#loginform" ).bind( "submit" , function () { var qString = $( '#loginform' ).formSerialize(); $.getJSON( 'login.html' , qString, function (json){ if (json.result == 1){ $( '#login' ).html( '' ); $( '#login' ).append( '<a href=profile.html?id=' + json.id + '>' + json.login + '</a> <a id="logout" href=""></a>' ); $( "#logout" ).bind( "click" , function () { $( '#login' ).load( "logout.html" );; return false ; }); } else { $( '#msg' ).html( '' ); $( '#msg' ).append( ' ' ); } }); return false ; }); //end ajax login //ajax logout $( "#logout" ).bind( "click" , function () { $( '#login' ).load( "logout.html" ); return false ; }); //end ajax logout }); //end document .ready * This source code was highlighted with Source Code Highlighter .
$( document ).ready( function (){ //ajax login $( "#loginform" ).bind( "submit" , function () { var qString = $( '#loginform' ).formSerialize(); $.getJSON( 'login.html' , qString, function (json){ if (json.result == 1){ $( '#login' ).html( '' ); $( '#login' ).append( '<a href=profile.html?id=' + json.id + '>' + json.login + '</a> <a id="logout" href=""></a>' ); $( "#logout" ).bind( "click" , function () { $( '#login' ).load( "logout.html" );; return false ; }); } else { $( '#msg' ).html( '' ); $( '#msg' ).append( ' ' ); } }); return false ; }); //end ajax login //ajax logout $( "#logout" ).bind( "click" , function () { $( '#login' ).load( "logout.html" ); return false ; }); //end ajax logout }); //end document .ready * This source code was highlighted with Source Code Highlighter .
$( document ).ready( function (){ //ajax login $( "#loginform" ).bind( "submit" , function () { var qString = $( '#loginform' ).formSerialize(); $.getJSON( 'login.html' , qString, function (json){ if (json.result == 1){ $( '#login' ).html( '' ); $( '#login' ).append( '<a href=profile.html?id=' + json.id + '>' + json.login + '</a> <a id="logout" href=""></a>' ); $( "#logout" ).bind( "click" , function () { $( '#login' ).load( "logout.html" );; return false ; }); } else { $( '#msg' ).html( '' ); $( '#msg' ).append( ' ' ); } }); return false ; }); //end ajax login //ajax logout $( "#logout" ).bind( "click" , function () { $( '#login' ).load( "logout.html" ); return false ; }); //end ajax logout }); //end document .ready * This source code was highlighted with Source Code Highlighter .
$( document ).ready( function (){ //ajax login $( "#loginform" ).bind( "submit" , function () { var qString = $( '#loginform' ).formSerialize(); $.getJSON( 'login.html' , qString, function (json){ if (json.result == 1){ $( '#login' ).html( '' ); $( '#login' ).append( '<a href=profile.html?id=' + json.id + '>' + json.login + '</a> <a id="logout" href=""></a>' ); $( "#logout" ).bind( "click" , function () { $( '#login' ).load( "logout.html" );; return false ; }); } else { $( '#msg' ).html( '' ); $( '#msg' ).append( ' ' ); } }); return false ; }); //end ajax login //ajax logout $( "#logout" ).bind( "click" , function () { $( '#login' ).load( "logout.html" ); return false ; }); //end ajax logout }); //end document .ready * This source code was highlighted with Source Code Highlighter .
$( document ).ready( function (){ //ajax login $( "#loginform" ).bind( "submit" , function () { var qString = $( '#loginform' ).formSerialize(); $.getJSON( 'login.html' , qString, function (json){ if (json.result == 1){ $( '#login' ).html( '' ); $( '#login' ).append( '<a href=profile.html?id=' + json.id + '>' + json.login + '</a> <a id="logout" href=""></a>' ); $( "#logout" ).bind( "click" , function () { $( '#login' ).load( "logout.html" );; return false ; }); } else { $( '#msg' ).html( '' ); $( '#msg' ).append( ' ' ); } }); return false ; }); //end ajax login //ajax logout $( "#logout" ).bind( "click" , function () { $( '#login' ).load( "logout.html" ); return false ; }); //end ajax logout }); //end document .ready * This source code was highlighted with Source Code Highlighter .
$( document ).ready( function (){ //ajax login $( "#loginform" ).bind( "submit" , function () { var qString = $( '#loginform' ).formSerialize(); $.getJSON( 'login.html' , qString, function (json){ if (json.result == 1){ $( '#login' ).html( '' ); $( '#login' ).append( '<a href=profile.html?id=' + json.id + '>' + json.login + '</a> <a id="logout" href=""></a>' ); $( "#logout" ).bind( "click" , function () { $( '#login' ).load( "logout.html" );; return false ; }); } else { $( '#msg' ).html( '' ); $( '#msg' ).append( ' ' ); } }); return false ; }); //end ajax login //ajax logout $( "#logout" ).bind( "click" , function () { $( '#login' ).load( "logout.html" ); return false ; }); //end ajax logout }); //end document .ready * This source code was highlighted with Source Code Highlighter .
$( document ).ready( function (){ //ajax login $( "#loginform" ).bind( "submit" , function () { var qString = $( '#loginform' ).formSerialize(); $.getJSON( 'login.html' , qString, function (json){ if (json.result == 1){ $( '#login' ).html( '' ); $( '#login' ).append( '<a href=profile.html?id=' + json.id + '>' + json.login + '</a> <a id="logout" href=""></a>' ); $( "#logout" ).bind( "click" , function () { $( '#login' ).load( "logout.html" );; return false ; }); } else { $( '#msg' ).html( '' ); $( '#msg' ).append( ' ' ); } }); return false ; }); //end ajax login //ajax logout $( "#logout" ).bind( "click" , function () { $( '#login' ).load( "logout.html" ); return false ; }); //end ajax logout }); //end document .ready * This source code was highlighted with Source Code Highlighter .
$( document ).ready( function (){ //ajax login $( "#loginform" ).bind( "submit" , function () { var qString = $( '#loginform' ).formSerialize(); $.getJSON( 'login.html' , qString, function (json){ if (json.result == 1){ $( '#login' ).html( '' ); $( '#login' ).append( '<a href=profile.html?id=' + json.id + '>' + json.login + '</a> <a id="logout" href=""></a>' ); $( "#logout" ).bind( "click" , function () { $( '#login' ).load( "logout.html" );; return false ; }); } else { $( '#msg' ).html( '' ); $( '#msg' ).append( ' ' ); } }); return false ; }); //end ajax login //ajax logout $( "#logout" ).bind( "click" , function () { $( '#login' ).load( "logout.html" ); return false ; }); //end ajax logout }); //end document .ready * This source code was highlighted with Source Code Highlighter .
$( document ).ready( function (){ //ajax login $( "#loginform" ).bind( "submit" , function () { var qString = $( '#loginform' ).formSerialize(); $.getJSON( 'login.html' , qString, function (json){ if (json.result == 1){ $( '#login' ).html( '' ); $( '#login' ).append( '<a href=profile.html?id=' + json.id + '>' + json.login + '</a> <a id="logout" href=""></a>' ); $( "#logout" ).bind( "click" , function () { $( '#login' ).load( "logout.html" );; return false ; }); } else { $( '#msg' ).html( '' ); $( '#msg' ).append( ' ' ); } }); return false ; }); //end ajax login //ajax logout $( "#logout" ).bind( "click" , function () { $( '#login' ).load( "logout.html" ); return false ; }); //end ajax logout }); //end document .ready * This source code was highlighted with Source Code Highlighter .
$( document ).ready( function (){ //ajax login $( "#loginform" ).bind( "submit" , function () { var qString = $( '#loginform' ).formSerialize(); $.getJSON( 'login.html' , qString, function (json){ if (json.result == 1){ $( '#login' ).html( '' ); $( '#login' ).append( '<a href=profile.html?id=' + json.id + '>' + json.login + '</a> <a id="logout" href=""></a>' ); $( "#logout" ).bind( "click" , function () { $( '#login' ).load( "logout.html" );; return false ; }); } else { $( '#msg' ).html( '' ); $( '#msg' ).append( ' ' ); } }); return false ; }); //end ajax login //ajax logout $( "#logout" ).bind( "click" , function () { $( '#login' ).load( "logout.html" ); return false ; }); //end ajax logout }); //end document .ready * This source code was highlighted with Source Code Highlighter .
$( document ).ready( function (){ //ajax login $( "#loginform" ).bind( "submit" , function () { var qString = $( '#loginform' ).formSerialize(); $.getJSON( 'login.html' , qString, function (json){ if (json.result == 1){ $( '#login' ).html( '' ); $( '#login' ).append( '<a href=profile.html?id=' + json.id + '>' + json.login + '</a> <a id="logout" href=""></a>' ); $( "#logout" ).bind( "click" , function () { $( '#login' ).load( "logout.html" );; return false ; }); } else { $( '#msg' ).html( '' ); $( '#msg' ).append( ' ' ); } }); return false ; }); //end ajax login //ajax logout $( "#logout" ).bind( "click" , function () { $( '#login' ).load( "logout.html" ); return false ; }); //end ajax logout }); //end document .ready * This source code was highlighted with Source Code Highlighter .
$( document ).ready( function (){ //ajax login $( "#loginform" ).bind( "submit" , function () { var qString = $( '#loginform' ).formSerialize(); $.getJSON( 'login.html' , qString, function (json){ if (json.result == 1){ $( '#login' ).html( '' ); $( '#login' ).append( '<a href=profile.html?id=' + json.id + '>' + json.login + '</a> <a id="logout" href=""></a>' ); $( "#logout" ).bind( "click" , function () { $( '#login' ).load( "logout.html" );; return false ; }); } else { $( '#msg' ).html( '' ); $( '#msg' ).append( ' ' ); } }); return false ; }); //end ajax login //ajax logout $( "#logout" ).bind( "click" , function () { $( '#login' ).load( "logout.html" ); return false ; }); //end ajax logout }); //end document .ready * This source code was highlighted with Source Code Highlighter .
$( document ).ready( function (){ //ajax login $( "#loginform" ).bind( "submit" , function () { var qString = $( '#loginform' ).formSerialize(); $.getJSON( 'login.html' , qString, function (json){ if (json.result == 1){ $( '#login' ).html( '' ); $( '#login' ).append( '<a href=profile.html?id=' + json.id + '>' + json.login + '</a> <a id="logout" href=""></a>' ); $( "#logout" ).bind( "click" , function () { $( '#login' ).load( "logout.html" );; return false ; }); } else { $( '#msg' ).html( '' ); $( '#msg' ).append( ' ' ); } }); return false ; }); //end ajax login //ajax logout $( "#logout" ).bind( "click" , function () { $( '#login' ).load( "logout.html" ); return false ; }); //end ajax logout }); //end document .ready * This source code was highlighted with Source Code Highlighter .
$( document ).ready( function (){ //ajax login $( "#loginform" ).bind( "submit" , function () { var qString = $( '#loginform' ).formSerialize(); $.getJSON( 'login.html' , qString, function (json){ if (json.result == 1){ $( '#login' ).html( '' ); $( '#login' ).append( '<a href=profile.html?id=' + json.id + '>' + json.login + '</a> <a id="logout" href=""></a>' ); $( "#logout" ).bind( "click" , function () { $( '#login' ).load( "logout.html" );; return false ; }); } else { $( '#msg' ).html( '' ); $( '#msg' ).append( ' ' ); } }); return false ; }); //end ajax login //ajax logout $( "#logout" ).bind( "click" , function () { $( '#login' ).load( "logout.html" ); return false ; }); //end ajax logout }); //end document .ready * This source code was highlighted with Source Code Highlighter .
$( document ).ready( function (){ //ajax login $( "#loginform" ).bind( "submit" , function () { var qString = $( '#loginform' ).formSerialize(); $.getJSON( 'login.html' , qString, function (json){ if (json.result == 1){ $( '#login' ).html( '' ); $( '#login' ).append( '<a href=profile.html?id=' + json.id + '>' + json.login + '</a> <a id="logout" href=""></a>' ); $( "#logout" ).bind( "click" , function () { $( '#login' ).load( "logout.html" );; return false ; }); } else { $( '#msg' ).html( '' ); $( '#msg' ).append( ' ' ); } }); return false ; }); //end ajax login //ajax logout $( "#logout" ).bind( "click" , function () { $( '#login' ).load( "logout.html" ); return false ; }); //end ajax logout }); //end document .ready * This source code was highlighted with Source Code Highlighter .
$( document ).ready( function (){ //ajax login $( "#loginform" ).bind( "submit" , function () { var qString = $( '#loginform' ).formSerialize(); $.getJSON( 'login.html' , qString, function (json){ if (json.result == 1){ $( '#login' ).html( '' ); $( '#login' ).append( '<a href=profile.html?id=' + json.id + '>' + json.login + '</a> <a id="logout" href=""></a>' ); $( "#logout" ).bind( "click" , function () { $( '#login' ).load( "logout.html" );; return false ; }); } else { $( '#msg' ).html( '' ); $( '#msg' ).append( ' ' ); } }); return false ; }); //end ajax login //ajax logout $( "#logout" ).bind( "click" , function () { $( '#login' ).load( "logout.html" ); return false ; }); //end ajax logout }); //end document .ready * This source code was highlighted with Source Code Highlighter .
$( document ).ready( function (){ //ajax login $( "#loginform" ).bind( "submit" , function () { var qString = $( '#loginform' ).formSerialize(); $.getJSON( 'login.html' , qString, function (json){ if (json.result == 1){ $( '#login' ).html( '' ); $( '#login' ).append( '<a href=profile.html?id=' + json.id + '>' + json.login + '</a> <a id="logout" href=""></a>' ); $( "#logout" ).bind( "click" , function () { $( '#login' ).load( "logout.html" );; return false ; }); } else { $( '#msg' ).html( '' ); $( '#msg' ).append( ' ' ); } }); return false ; }); //end ajax login //ajax logout $( "#logout" ).bind( "click" , function () { $( '#login' ).load( "logout.html" ); return false ; }); //end ajax logout }); //end document .ready * This source code was highlighted with Source Code Highlighter .
$( document ).ready( function (){ //ajax login $( "#loginform" ).bind( "submit" , function () { var qString = $( '#loginform' ).formSerialize(); $.getJSON( 'login.html' , qString, function (json){ if (json.result == 1){ $( '#login' ).html( '' ); $( '#login' ).append( '<a href=profile.html?id=' + json.id + '>' + json.login + '</a> <a id="logout" href=""></a>' ); $( "#logout" ).bind( "click" , function () { $( '#login' ).load( "logout.html" );; return false ; }); } else { $( '#msg' ).html( '' ); $( '#msg' ).append( ' ' ); } }); return false ; }); //end ajax login //ajax logout $( "#logout" ).bind( "click" , function () { $( '#login' ).load( "logout.html" ); return false ; }); //end ajax logout }); //end document .ready * This source code was highlighted with Source Code Highlighter .
$( document ).ready( function (){ //ajax login $( "#loginform" ).bind( "submit" , function () { var qString = $( '#loginform' ).formSerialize(); $.getJSON( 'login.html' , qString, function (json){ if (json.result == 1){ $( '#login' ).html( '' ); $( '#login' ).append( '<a href=profile.html?id=' + json.id + '>' + json.login + '</a> <a id="logout" href=""></a>' ); $( "#logout" ).bind( "click" , function () { $( '#login' ).load( "logout.html" );; return false ; }); } else { $( '#msg' ).html( '' ); $( '#msg' ).append( ' ' ); } }); return false ; }); //end ajax login //ajax logout $( "#logout" ).bind( "click" , function () { $( '#login' ).load( "logout.html" ); return false ; }); //end ajax logout }); //end document .ready * This source code was highlighted with Source Code Highlighter .
$( document ).ready( function (){ //ajax login $( "#loginform" ).bind( "submit" , function () { var qString = $( '#loginform' ).formSerialize(); $.getJSON( 'login.html' , qString, function (json){ if (json.result == 1){ $( '#login' ).html( '' ); $( '#login' ).append( '<a href=profile.html?id=' + json.id + '>' + json.login + '</a> <a id="logout" href=""></a>' ); $( "#logout" ).bind( "click" , function () { $( '#login' ).load( "logout.html" );; return false ; }); } else { $( '#msg' ).html( '' ); $( '#msg' ).append( ' ' ); } }); return false ; }); //end ajax login //ajax logout $( "#logout" ).bind( "click" , function () { $( '#login' ).load( "logout.html" ); return false ; }); //end ajax logout }); //end document .ready * This source code was highlighted with Source Code Highlighter .
$( document ).ready( function (){ //ajax login $( "#loginform" ).bind( "submit" , function () { var qString = $( '#loginform' ).formSerialize(); $.getJSON( 'login.html' , qString, function (json){ if (json.result == 1){ $( '#login' ).html( '' ); $( '#login' ).append( '<a href=profile.html?id=' + json.id + '>' + json.login + '</a> <a id="logout" href=""></a>' ); $( "#logout" ).bind( "click" , function () { $( '#login' ).load( "logout.html" );; return false ; }); } else { $( '#msg' ).html( '' ); $( '#msg' ).append( ' ' ); } }); return false ; }); //end ajax login //ajax logout $( "#logout" ).bind( "click" , function () { $( '#login' ).load( "logout.html" ); return false ; }); //end ajax logout }); //end document .ready * This source code was highlighted with Source Code Highlighter .
$( document ).ready( function (){ //ajax login $( "#loginform" ).bind( "submit" , function () { var qString = $( '#loginform' ).formSerialize(); $.getJSON( 'login.html' , qString, function (json){ if (json.result == 1){ $( '#login' ).html( '' ); $( '#login' ).append( '<a href=profile.html?id=' + json.id + '>' + json.login + '</a> <a id="logout" href=""></a>' ); $( "#logout" ).bind( "click" , function () { $( '#login' ).load( "logout.html" );; return false ; }); } else { $( '#msg' ).html( '' ); $( '#msg' ).append( ' ' ); } }); return false ; }); //end ajax login //ajax logout $( "#logout" ).bind( "click" , function () { $( '#login' ).load( "logout.html" ); return false ; }); //end ajax logout }); //end document .ready * This source code was highlighted with Source Code Highlighter .