Discussion:
[Caja] pass html as content
eqSan
2016-04-30 21:17:16 UTC
Permalink
I'm trying to call stored html from DB and pass it as content to frame.code
like this:

<div id="guest"></div>
<script type="text/javascript">
caja.initialize({
cajaServer: 'https://caja.appspot.com/'
});
caja.load(document.getElementById('guest'), undefined,
function(frame) {
frame.code('www.trs.com/fdg.html',
'text/html',
'$data_from_db' )
.run();
});
</script>

*Result=Nothing*
------------------
$data_from_db=<html><head><title></title></head><body>Hello</body></html>

in my DB
------------------

but caja can't retunr it as result "Hello" and nothing back!

another hand I tried pass same HTML as a content not from DB and wondering
getting result!

<div id="guest"></div>
<script type="text/javascript">
caja.initialize({
cajaServer: 'https://caja.appspot.com/'
});
caja.load(document.getElementById('guest'), undefined,
function(frame) {
frame.code('www.trs.com/fdg.html',
'text/html',
'
<html><head><title></title></head><body>Hello</body></html>' )
.run();
});
</script>

*Result=Hello*

---------------------------------

how can I pass HTML data from DB as mentioned and get back correct result
from caja same as when I passed HTML as text content?
--
---
You received this message because you are subscribed to the Google Groups "Google Caja Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-caja-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Mike Stay
2016-04-30 23:52:46 UTC
Permalink
It looks like you're using PHP; don't you have to wrap the variable in
a <?php ...?> tag?
Post by eqSan
I'm trying to call stored html from DB and pass it as content to frame.code
<div id="guest"></div>
<script type="text/javascript">
caja.initialize({
cajaServer: 'https://caja.appspot.com/'
});
caja.load(document.getElementById('guest'), undefined, function(frame)
{
frame.code('www.trs.com/fdg.html',
'text/html',
'$data_from_db' )
.run();
});
</script>
Result=Nothing
------------------
$data_from_db=<html><head><title></title></head><body>Hello</body></html>
in my DB
------------------
but caja can't retunr it as result "Hello" and nothing back!
another hand I tried pass same HTML as a content not from DB and wondering
getting result!
<div id="guest"></div>
<script type="text/javascript">
caja.initialize({
cajaServer: 'https://caja.appspot.com/'
});
caja.load(document.getElementById('guest'), undefined, function(frame)
{
frame.code('www.trs.com/fdg.html',
'text/html',
'<html><head><title></title></head><body>Hello</body></html>' )
.run();
});
</script>
Result=Hello
---------------------------------
how can I pass HTML data from DB as mentioned and get back correct result
from caja same as when I passed HTML as text content?
--
---
You received this message because you are subscribed to the Google Groups
"Google Caja Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
Mike Stay - ***@gmail.com
http://www.cs.auckland.ac.nz/~mike
http://reperiendi.wordpress.com
--
---
You received this message because you are subscribed to the Google Groups "Google Caja Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-caja-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...