標題說,所有的東西都有一個優點:我不想在我的網頁正文中添加<div id="something"></div>
。使用jQuery UI對話框,我如何從另一個網頁加載內容?
我發現這個在互聯網上:
var $mklib = $('<div></div>')
.html('test')
.dialog({
title: "Create a library",
autoOpen: false,
show: "fade",
hide: "fade",
draggable: false,
resizable: false,
height: 150,
width: 300,
buttons: { "Create": function() {
$(this).dialog("close"); }
},
});
$(".open_mklib").click(function() {
$mklib.dialog("open");
return false;
});
但我需要的.html('test')
是'load_that_*****_page.php'
而且題外話,我需要創建按鈕發送,這將是load_that_*****_page.php
裏面的形式。 ..
任何超人的救援?
非常感謝!
好吧,我在網上找到了,這裏是代碼,但是當我點擊Submit時,它不起作用! :P (網址:http://magix-cjquery.com/post/2010/08/01/jquery-ui-dialog-avec-soumission-de-formulaire-ajax)
$('.open_mklib').live("click",function(){
var box_url = "./functions/modal.php";
var form_url = "./";
$("#mklib").load(box_url, function() {
$(this).dialog({
title: 'New Library',
height: 'auto',
width:'auto',
resizable: false,
modal: true,
position: 'center',
overlay: {
backgroundColor: '#000',
opacity: 0.5
},
buttons: {
'Submit': function() {
$("#mklib form").ajaxSubmit({
url: box_url,
type: "post",
error: function(){
alert("theres an error with AJAX");
},
beforeSubmit:function(){},
success: function(e){}
});
$(this).dialog('close');
},
'Cancel': function() {
$(this).dialog('close');
}
}
});
});
});
你說「標題說所有東西都有一樣東西」,但我不明白標題說的是什麼。我將它改爲:「使用jQuery UI對話框,我如何從另一個網頁加載內容?」。你在問什麼? – Josh 2010-10-14 01:00:16
是的;)對不起:S – 2010-10-14 01:03:25
(真的對不起喬希我的英文真的很差,所以我認爲它很清楚,可以理解,但它可能都是相反的) – 2010-10-14 01:05:05