2015-01-17 2 views
1
function sendMsg(){ 

     $.ajax({ 
      beforeSend: function(){ 
       $("#loading").dialog('open').html("<p>Please Wait...</p>"); 
       }, 
      url: "${pageContext.request.contextPath}/WhoopieeMerchantAppConversationList", //(dynamically generated by product item), //(dynamically generated by product item) 
      type: "get", 
      data:"to_userid="+document.getElementById('to_userid').value+"&store_id="+document.getElementById('store_id').value+"&merchant_id="+document.getElementById('merchant_id').value+"&msg="+document.getElementById('msg').value, 
      success: ajaxSuccessHandler 
     }); 
    } 
    function ajaxSuccessHandler(obj) { 
     if(obj=="error") 
     { 
      $('#loading').html("<p style='font-size:18px;'>Msg Already Sent</p>"); 
     } 
     else 
     { 
      $("#loading").dialog("close"); 
      alert("Message Sent Successfully"); 
      var redirect_link = document.getElementById('redirect').value; 
      setTimeout(function(){window.location.href=redirect_link},0); 
     } 
    } 

후 닫습니다,하지만 여전히 당신이를 다시 사용하지 않으려면,JQuery와 대화 상자 아약스 성공 난 아약스 호출 후 대화 상자를 닫으려면

+0

왜 경고를이 시도 ??? 대화 상자를 닫기 전에 그냥 쓰십시오. – mplungjan

+0

경고 상자에서 확인을 누른 후 리디렉션하고 싶기 때문에 대화 상자가 아닙니다. –

+1

모달 대화 상자를 사용하십시오. 경고는 모든 스크립트를 차단합니다. 또는 경고를 setTimeout 내에 두십시오. – mplungjan

답변

0

도와주세요 경고 상자의 뒷면에 표시되지 모달 대화 상자와 같은 대화 상자가

$("#loading").dialog("close"); 
setTimeout(function(){ 
    alert("Message Sent Successfully"); 
    window.location.href=document.getElementById('redirect').value; 
},100) 

또는 대화 창조

close: function(){ 
    alert("Message Sent Successfully"); 
    window.location.href=document.getElementById('redirect').value; 
}, 
관련 문제