javascript
  • html
  • 2016-09-19 5 views -2 likes 
    -2
    function theFinale() 
    { document.getElementById("pop2").style.display = 'none'; 
         document.getElementById("myPopup").style.display = 'none'; 
         document.getElementById("pop3").style.display = 'none'; 
    
    
         document.getElementById("pop4").style.display = 'block'; 
         document.getElementById('pop4').style.position = "absolute"; 
         document.getElementById('pop4').style.top = '250px'; 
         document.getElementById('pop4').style.left = '250px'; 
         setTimeout(function(){ 
         document.getElementById('pop4').className = 'waa'; 
         }, 2500); 
        window.line=document.getElementById('answer').value; 
    
           { 
            $.ajax({ 
          type: 'POST', 
          url: 'qwe.php', 
          data: {z: line}, 
          success: function(data) { 
    
           $("q").text(data); 
    
          } 
         }); 
          document.getElementById('answer').reset(); 
           } 
           window.location.href=window.location.href; 
    } 
    

    この機能を実行した後に更新したいです。 htmlフォームで取るすべてのフォーム値もリセットする必要があります。関数を実行した後にページを更新したいですか?

    +0

    'LOCATION.HREF = location.href' –

    +0

    に動作していないカルティク – Rahul

    +0

    window.locationのsuccess

    theFinaleの機能でclearTimeout()を呼び出します。 reload(); – nikhil

    答えて

    0
    success: function(data) { 
          $("q").text(data); 
          location.reload() 
         } 
    

    これを試しましたか?

    +0

    はい、動作していません – Rahul

    +0

    編集しました - 今すぐお試しください – nikjohn

    +0

    えええええええええええええええ – Rahul

    3

    は結果を非同期的に返します。 window.location.href=window.location.hrefsuccessに移動させると、$.ajax()の関数になります。 $.ajax()コールの前に{という2つの構文エラーを削除し、document.getElementById('answer').reset();の後に}を削除します。 setTimeoutするための識別子を提供し、

    var timeout = null; 
    

    timeout = setTimeout(function(){ 
        document.getElementById('pop4').className = 'waa'; 
    }, 2500); 
    
    success: function(data) { 
          clearTimeout(timeout); 
          window.location.href=window.location.href; 
    
         } 
    
    +0

    ありがとうございました – Rahul

    +0

    私はそれを特定の時間の後にリロードできますか? – Rahul

    +0

    @Rahul _ "特定の時間の後にリロードすることはできますか?" – guest271314

    関連する問題