Welcome Guest, Not a member yet? Register   Sign In
Problem when loading a helper using jQuery Ajax
#1

[eluser]CARP[/eluser]
I've implemented this helper:
CKEditor helper for codeIgniter
http://www.kromack.com/codeigniter/ckedi...deigniter/

The helper works great when I call the following way
http://localhost/index.php/myapp/mycontr...function/X

When I use jQuery Ajax to load the same url, but inside a div from another view, the editor doesn't show

Code:
jQuery("#mytextarea").change(function() {
    var idC;
    idC = jQuery("#otherfield").val();
    jQuery("#details").empty();
    if (idC > 0)
    {
        jQuery("#details").load("<?=site_url('mycontroller/myfunction')?>/"+idC);
    }
});

I guess the problem must be reside in ajax, right? because when I load the url directly, editor shows fine, etc. Hope you've understood my idea
#2

[eluser]JHackamack[/eluser]
I'm assuming you've looked at your source and made sure that <?= is working correctly. I've had many default setups that <?= threw out error messages and I had to replace it with <?php echo Also have you used a debugger in Firefox/Safari to see the actual call being made by jquery to make sure its taking everthing on correctly?
#3

[eluser]CARP[/eluser]
Oops
I didn't know <?= shorttag causes that... Will try this tomorrow (2am here)
#4

[eluser]JHackamack[/eluser]
In referencing:

http://ellislab.com/codeigniter/user-gui..._open_tags

Always use full PHP opening tags, in case a server does not have short_open_tag enabled.

INCORRECT:
<? echo $foo; ?>

<?=$foo?>

CORRECT:
<?php echo $foo; ?>

It all depends on your server config, so to make the app portable to different servers. Viewing the source of your rendered page will tell you if it works or not.
#5

[eluser]Kromack[/eluser]
Could you monitor with the Firebug's console panel if any JavaScript error is triggered ?

Especially if any script file that is required is not loaded (with a 404 error for example).
#6

[eluser]CARP[/eluser]
Hi guys. Please let me explain better
All my code use short open/close tag <?=?> and I have the short_open_tag enabled

1)
When I call the controller directly in the browser bar, for example:
Code:
http://localhost/myapp/index.php/mycontroller/myfunct/myID
Everything shows perfectly, with the WYSIWYG editor showing perfectly

2)
If I call that url from within another view (using jQuery ajax)... I mean
Code:
...
jQuery("#divdetails").load("http://localhost/myapp/index.php/mycontroller/myfunct/myID");
...
I get the following errors, like if something related to javascript, jquery or ajax, isn't being loaded in the ajax call. Firebug shows me this error (which makes editor not showing)

http://www.google.com.ar/search?hl=es&q=...;=&aq=f&oq;=
#7

[eluser]JHackamack[/eluser]
that looks like an FCK Editor, are you using FCK on your site at all?
#8

[eluser]Kromack[/eluser]
l.lang.about is undefined means that CKEditor is not correctly initialized.

The Ajax call might be the reason, you should check if all the JavaScript paths are correctly written when the Ajax call is made.
#9

[eluser]Kromack[/eluser]
Are you using the user guide's .htaccess file ? If so, please try to move out ckeditor into js/ckeditor for example since system/plugins could be unreachable.

You also have to donwload the new version of the helper in order to set the new key 'path'.




Theme © iAndrew 2016 - Forum software by © MyBB