作者:oth0037112 | 来源:互联网 | 2023-05-18 23:59
Itryloadingcontentintoadivwiththistutorial.Unfortunately,thissimplyloadstheHTMLfile
I try loading content into a div with this tutorial. Unfortunately, this simply loads the HTML file as a new page.
我尝试使用本教程将内容加载到div中。不幸的是,这只是将HTML文件作为新页面加载。
This is the Javascript that should do the job
这是应该完成这项工作的Javascript
window.addEvent('domready', function() {
$('runAjax').addEvent('click', function(event) {
event.stop();
var req = new Request({
method: 'get',
url: $('runAjax').get('href'),
data: { 'do' : '1' },
onRequest: function() { alert('The request has been made, please wait until it has finished.'); },
onComplete: function(response) { alert('Response received.); $('container').set('html', response); }
}).send();
$('runAjax').removeEvent('click');
});
});
this is the link that should initiate the function
这是应该启动该功能的链接
Profil
and this is the div-structure of index.html. i want the content to be loaded into the "container"-div
这是index.html的div结构。我希望将内容加载到“容器”-div中
I dont really care what script i use as long as its compatible with MooTools 1.2, because i need it for a sliding top panel and it would be a lot more work to change it to a jquery panel for example.
我并不关心我使用的脚本,只要它与MooTools 1.2兼容,因为我需要它用于滑动顶部面板,例如将它更改为jquery面板会更多。
3 个解决方案