2017-09-19 21 views
0

私はこの問題に取り組んでいますが、これを解決する方法はわかりません。誰もこれで助けることができますか?ダイアログでCssとJqueryが正しく機能しない

問題は2つのアプリケーションがあることです。アプリケーションをまとめてページが期待どおりに動作していないのですが。個別に、彼らは正常に動作しています。

ここで問題が発生します。第1アプリケーションのJqueryダイアログで2番目のアプリケーションページを読み込もうとしています。 すべてがロードされていますが、CSSとjqueryは機能していません

2番目のアプリケーションはAsp.net mvcアプリケーションです。ここでは、剃刀の代わりに合計htmlページを返します。

私は以下のコードを添付しています。

<div style="display: none; background-color: White; width: 100%; height: 
90%; border: 0px; 
     margin-left: 0px !important; overflow: hidden; background-color: rgb(255, 255, 255);" 
     id='approvalRulePopup'> 

    </div> 


$.ajax({ 
    type: "POST", 
    url: pData.URL, 
    data: pData, 
    dataType: "text", 
    timeout: "60000", 
    error: function (XMLHttpRequest, textStatus, errorThrown) { 

     $.unblockUI(); 

     if (textStatus == 'timeout') 
      $.prompt(hashtable["consTimeoutError"].toString()); 

     if (textStatus == "error" && eval(XMLHttpRequest).responseText == "") 
      $.prompt(hashtable["consTimeoutError"].toString()); 

    }, 
    success: function (data) { 
     $('#approvalRulePopup').empty(); 
     $('#approvalRulePopup').html(data); 
     $.unblockUI(); 
    }, 
    complete: function() { 

    } 
}); 
+0

ページ(ビュー)ではなく、HTMLのスニペット(部分図)のいずれかをロードしているように見えます。その場合は、おそらくダイアログにiframeを置き、iframeのsrcを2ページ目に設定したいと思うでしょう。あなたのページに別のアプリケーションのhtmlを置くと、2つのcssセットが混じり合い、予期せぬ結果が得られます。iframeを使用すると完全に分離された状態になります。 –

+0

私はこれを試しましたが、ポストアクションでURLとしてsrcを与えるオプションがあります。いくつかのヘッダー値を持つユーザーを検証するので、 –

+0

ありがとう@フリー。 –

答えて

0

何百もの間苦労して、私はiframe postを使用してこの問題を解決しました。

HTMLコード:

<div style="display: none; background-color: White; width: 100%; height: 90%; border: 0px; 
    margin-left: 0px !important; overflow: hidden; background-color: rgb(255, 255, 255);" 
    id='divPopup'> 
    <form id="formPopup" method="post" style="display: none;" target="Iframeone" 
    action=""> 
    </form> 
    <iframe src="" id="Iframeone" name="Iframeone" style="width: 97%; height: 90%; position: absolute; 
     min-height: 540px;"></iframe> 
</div> 

のjQueryコード:

function ProcessIFrameByPost(pData) { 

// Pdata = Json data 

// Getting the window height and width 

var wWidth = $(window).width(); 
var dWidth = wWidth * 0.95; 
var wHeight = $(window).height(); 
var dHeight = wHeight * 0.80; 

// Creating jquery dialog 

if (!$("#divPopup").hasClass("ui-dialog-content")) { 

    $("#divPopup").dialog({ 
     autoOpen: false, 
     modal: true, 
     width: dWidth, 
     height: dHeight, 
     position: "center", 
     enableMaximize: true, 
     open: function (ev, ui) { 
      ev.preventDefault(); 

     } 
    }); 
} 

// Clearing previous data 

$('#formPopup').html(''); 
$('#Iframeone').html(''); 

// adding the action URL 
$('#formPopup').attr("action", pData.URL); 

// Appending the data to form 

for (var key in pData) { 
    if (pData.hasOwnProperty(key)) { 
     var hiddenField = document.createElement("input"); 
     hiddenField.setAttribute("type", "hidden"); 
     hiddenField.setAttribute("name", key); 
     hiddenField.setAttribute("value", pData[key]); 

     $('#formPopup').append(hiddenField); 
    } 
} 

$('#divPopup').dialog('open'); 

$('#formPopup').submit(); 
} 
関連する問題