私はこれに苦労していて、ファンシーボックスのiframeに結果を表示する方法を見つけました。ajaxはまだ得意ではないので、jqueryを使用したphpソリューションが必要でした。私の最初の答えです!!:
jquery.fancyboxjsファイルで少し調整する必要があります。私はを使用してjquery.fancybox.1.3.4.pack.js
いました。これを任意のエディターなどで開き、次のように検索しますname="fancybox-frame
::それだけです。これのインスタンスは1つだけで、次のようになります。
name="fancybox-frame'+(new Date).getTime()+'"
次に、全体の名前を変更します。
fancybox-frame'+(new Date).getTime()+'`
あなたが望むものなら何でも、私はそれを呼んだ:"fbframe"
そしてファイルを保存する。次に、jquery設定を追加し、次のようにフォームを作成すると、正常に機能するはずです。
//activate jquery on page load and set onComplete the most important part of this working
$(document).ready(function(){
$("#a").fancybox({
'width' : '75%',
'height' : '100%',
'autoScale' : false,
'type' : 'iframe',
'onComplete':function (){$('#formid').submit();},
});
});
//function called onclick of form button.
function activatefancybox(Who){
$("#setID").val(Who); // i set the value of a hidden input on the form
$("#a").trigger('click');//trigger the hidden fancybox link
}
// hidden link
<a id="a" href='#'></a>
// form to submit to iframe to display results.
// it is important to set the target of the form to the name of
// the iframe you renamed in the fancybox js file.
<form name='iduser' id='iduser' action='page.php' target='fbframe' method='post'>
<input />
<input />
<input id='setID' type='hidden' name='userid' value='' />
<input type="button" onClick='testfb(123)' />
</form>
プロセスは次のとおりです。
[送信]->[関数の呼び出し]->[関数]をクリックし、[FBリンク]->[onComplete]をクリックします
onComplete FBがフォームをロードした後、フォームをiframeに送信します。終わり。
私はこれを現在のプロジェクトから取り除いて、特定の必要な部分を編集したばかりであることに注意してください。私はまだアマチュアのコーダーであり、可能であればajaxをお勧めします。また、FB1のみを使用しています!FB2が利用可能になりました。