Ajax 在一个标记中加载多个项目
我正在尝试构建一个类似windows的应用程序,我希望用户能够加载多个页面。目前我有以下要求:Ajax 在一个标记中加载多个项目,ajax,jquery-load,Ajax,Jquery Load,我正在尝试构建一个类似windows的应用程序,我希望用户能够加载多个页面。目前我有以下要求: // Open the Profile Search Windows $("#MainMenuProfileButton").click(function() { $("#ProgramContent").load("forms/ProfileSearch.html",function() { // Attach Event to the Profile Search Windows
// Open the Profile Search Windows
$("#MainMenuProfileButton").click(function() {
$("#ProgramContent").load("forms/ProfileSearch.html",function() {
// Attach Event to the Profile Search Windows
$(".ProfileFormSearch").draggable({ handle: ".FormTopTitle" });;
});
});
但当我运行两次命令时,它将重新加载同一个窗口,而不是打开第二个窗口(或将html附加到现有窗口中)。。。你知道我该怎么办吗
谢谢你,而不是:
$(".ProfileFormSearch").draggable({ handle: ".FormTopTitle" });
您可以使用:
$(".ProfileFormSearch:not(.init)").addClass('init').draggable({ handle: ".FormTopTitle" });
通过这种方式,您可以确保DragTable不会被重新初始化
编辑:
要使用ajax动态加载,应执行以下操作:
$.get('forms/ProfileSearch.html', function(data){ $("#ProgramContent").append( data ); })
问题是我希望用户在程序内容中插入两到三个“Profilesearch.html”。但是这段代码只允许我添加一个广告。哦,你基本上有一个ajax问题,而不是拖拉:)请看我的编辑。