Jquery .load 需要页面刷新但也返回 false - 帮助

发布于 2024-09-07 21:39:32 字数 578 浏览 1 评论 0原文

大家好,这可能很简单,但不知道如何去做。

我正在将页面加载到 div 中,如下所示:

$('.pageLink').click(function() {
var pagetoload = ($(this).attr('href').substring(5));
$('#adminArea').load(pagetoload+'.php');
return false;
});

这完全没有问题。唯一的问题是我在“几个”加载的页面上使用 CKEditor 并在所有页面中显示 CKEditor 似乎需要页面刷新我知道这是完全错误并且不起作用(显然) 但它让您了解需要什么,以及如何实现它 - 如果可能的话。

$('.pageLink').click(function() {
var pagetoload = ($(this).attr('href').substring(5));
return true;
$('#adminArea').load(pagetoload+'.php');
return false;
});

有什么想法吗? - 提前致谢

Hi folks this is prob quiet simple but not sure how to do it.

I am loading pages into a div a simple like this:

$('.pageLink').click(function() {
var pagetoload = ($(this).attr('href').substring(5));
$('#adminArea').load(pagetoload+'.php');
return false;
});

That works no probs at all. Only thing is that I am using CKEditor on "several"of the loaded pages and to display CKEditor in all the pages it seems to require a page refresh I know this is TOTALLY wrong and does not work (obviously) but it gives you an idea of what is needed, just how do you achieve it - if it is possible.

$('.pageLink').click(function() {
var pagetoload = ($(this).attr('href').substring(5));
return true;
$('#adminArea').load(pagetoload+'.php');
return false;
});

any ideas? - thanks in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

安静 2024-09-14 21:39:32

实现 CKE 时,您必须使用如下代码段。

CKEDITOR.replace( 'editor1' );

当您从 Ajax 访问时,会在编辑器附加到页面之前调用此函数。你可以尝试一件事。加载 ajax 内容后,再次在指定控件上调用 CKEDITOR.replace() 函数。这可能会解决你的问题。

[编辑]

$('#adminArea').load(pagetoload+'.php');
CKEDITOR.replace( 'EDITOR' );

[编辑2]

$('#adminArea').load(pagetoload+'.php', function() {
  CKEDITOR.replace( 'EDITOR' );
});

When implementing CKE you have to use a code segment like below.

CKEDITOR.replace( 'editor1' );

While you are accessing from Ajax this is called before the editor is attached to the page. You can try one thing. After loading your ajax content, then call the CKEDITOR.replace() function on a specified control again. This might solve your problem.

[EDIT]

$('#adminArea').load(pagetoload+'.php');
CKEDITOR.replace( 'EDITOR' );

[EDIT 2]

$('#adminArea').load(pagetoload+'.php', function() {
  CKEDITOR.replace( 'EDITOR' );
});
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文