2011-01-13 10 views
0
$return['error'] = false; 
$return['msg'] = 'You have been logged in! You will be redirected to the UserCP in 3 seconds! If redirection fails <a href="usercp.php">click here</a>'; 

<a hrefが返されていますが、<a hrefがリンクではなくテキストとして表示されています。ajaxメッセージの返信にhrefを挿入します。

AjaxコードのReleventスニペット:

$.ajax({ 
      type : 'POST', 
      url : 'logina.php', 
      dataType : 'json', 
      data: { 
       type : $('#typeof').val(), 
       login : $('#login').val(), 
       pass : $('#pass').val(), 


      }, 
      success : function(data){ 
       $('#waiting').hide(500); 
       $('#empty').show(500); 
       $('#message').removeClass().addClass((data.error === true) ? 'error' : 'success') 
        .text(data.msg).show(500) 
        if (data.error === true){ 
        $('#reg').show(500);ß 
        $('#empty').hide(); 
       } 
       else { 
       setTimeout(function(){ document.location = 'http://blahblah.com/usercp.php';}, 3000); 

        } 

答えて

4

というよりは.text .htmlを使用:

 
$('#message').removeClass().addClass((data.error === true) ? 'error' : 'success') 
        .html(data.msg).show(500) 
+0

ねえのおかげでそんなに男! 1.5分以内に完全に正解します。病気は9分笑ってくれます。P – NoviceCoding

+2

問題ありません。あなたはここで急いでいなければならない。 :) –

+0

素晴らしいcrimson_penguin :) – sarnold

関連する問題