标题说,所有的东西都有一个优点:我不想在我的网页正文中添加<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