I’m using a .load() call to open a url inside a div. The url has a richhtml editor TinyMCE and it is initialized using the code below. The problem is the richhtml editor loads just fine when the url is accessed directly, but whenever the url is used as a .load(url) then the richtext editor doesn’t initialize at all. I have the Mimetype set on the script so it should execute? It looks like it is executing, there is just browser errors telling me ‘Object Required’ when i try.
I would like the Richtext editor to be initialized within the url so an extra initialization doesn’t have to be done on the container’s url using the .load(url,init) function.
Any suggestions?
<script type="text/javascript" src="/js/tiny_mce/tiny_mce.js"></script>
<!--Rich Text Editor -->
<textarea name="desc" id="desc"></textarea>
<script type="text/javascript">
tinyMCE.init({mode : "exact", elements : "desc", theme : "advanced",theme_advanced_buttons3_add : "code"});
</script>
Same result using .getScript();
<textarea name="desc" id="desc"></textarea>
<script type="text/javascript">
$(document).ready(function(){
$.getScript('/js/tiny_mce/tiny_mce.js', function() {
tinyMCE.init({mode : "exact", elements : "desc", theme : "advanced",
theme_advanced_buttons3_add : "code"});
});
});
</script>
“Object Required” sounds like the
tiny_mce.jsfile isn’t being included and since you are trying to access a property of thetinyMCEobject the parser is expecting an object to already be declared.Try including the
tiny_mce.jsfile into the document that is making the AJAX request and see if that solves the issue.UPDATE
Source: http://api.jquery.com/load