Javascript for loop
Hello, I recently ended up as a Cascade admin for my college and I'm relatively lost. I'm trying to get a javascript for loop working on a page, but it's rendering my less than character as < :
for (i = 0; i < data.response.award.length; i++)
I know that cascade tends to javascript in //<![CDATA[, which I believe tells the system to not escape characters? I'm typing this into my WYSIWYG (I'm assuming it's TinyMCE?) through the HTML button:
<script type="text/javascript">// <![CDATA[
function processJson(data) {
text = ""
for (i = 0; i < data.response.award.length; i++) {
//do some sutff
}
$('$x').html(text)
//alert(data.response.award[0].agency);
}
// ]]></script>
Any suggestions?
Discussions are closed to public comments.
If you need help with Cascade CMS please
start a new discussion.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
1 Posted by jymenn on 12 Oct, 2015 01:12 PM
Threw the js in a separate file and called it from page. Working now.
2 Posted by Ryan Griffith on 13 Oct, 2015 04:14 PM
Hi,
Another way to accomplish this would be to use a
#protect
code section to ensure Cascade does not attempt to clean up invalid XML. For example:Please let me know if you have any questions.
Thanks!
Tim closed this discussion on 30 Oct, 2015 03:24 PM.