- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-28-2017 10:37 AM
I am building UI macro and I am new to Jelly language. I am trying to figure out how to set up For loop in <script> tag because I got return of multiple values(Group Members) using JSON from GlideAjax Script Include. I need a loop to separate values to make a list in table HTML. Do I need to use Jelly foreach tag or I can use javascript For loop? If so then is my code are correct using "answer" variable in foreach loop as array? Here is my script,
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-28-2017 11:03 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-28-2017 10:46 AM
Hi Bradley,
I think your confusion comes from trying to use Jelly (server-side processing at page load) with GlideAjax (initiated client-side).
From your snippet, it looks like you are trying to lookup some group data when a form is populated (I'm guessing catalog form) to create a custom table. I would just forget about Jelly altogether since everything will occur after the page is loaded. Just use a regular for loop to iterate through your results.
Also, using jQuery might help you out a bit. As long as you use the work 'jQuery' in place of the dollar sign ($), you should be okay.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-28-2017 10:57 AM
Is using for(var count = 0; count &lt; answer.length; count++) suppose to work because I assume &lt; mean <=? I tried that way and nothing happen.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-28-2017 11:03 AM
Try this
for(var count = 0; count < answer.length; count++)