Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6649581
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:47:28+00:00 2026-05-26T00:47:28+00:00

Appreciate some insight given the following code: <script type=text/javascript> $(document).ready(function() { var soapEnv =

  • 0

Appreciate some insight given the following code:

<script type="text/javascript">
$(document).ready(function() {
    var soapEnv =
        "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> \
            <soapenv:Body> \
                 <GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
                    <listName>video_player</listName> \
                    <viewFields> \
                        <ViewFields> \
                           <FieldRef Name='Title' /> \
                       </ViewFields> \
                    </viewFields> \
                </GetListItems> \
            </soapenv:Body> \
        </soapenv:Envelope>";

    $.ajax({
        url: "_vti_bin/lists.asmx",
        type: "POST",
        dataType: "xml",
        data: soapEnv,
        complete: processResult,
        contentType: "text/xml; charset=\"utf-8\""
    });
});

function processResult(xData, status) {
    $(xData.responseXML).find("z\\:row").each(function() {
        var liHtml = "<a href='" + $(this).attr("ows_Title") + "'><img src='" + $(this).attr("ows_snapshot_file_location") + "' width=120 height=90><strong>" + $(this).attr("ows_video_description") + "</strong><br /><br />" + $(this).attr("ows_video_description") + "<em>" + $(this).attr("ows_video_length") + "</em></a><br />";
        //{missing code}//
    });
}
</script>

What code should I enter inside the //{missing code}// such that I can store the variable ‘lihtml’ into a array that can be used in any javascript? (I wish to use document.write() to display the “lihtml” variable.

UPDATE 1:
After taking minus4 consideration, the code is as follows:

<script type="text/javascript">
var glob;

$(document).ready(function() {
    var soapEnv =
        "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> \
            <soapenv:Body> \
                 <GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
                    <listName>video_player</listName> \
                    <viewFields> \
                        <ViewFields> \
                           <FieldRef Name='Title' /> \
                       </ViewFields> \
                    </viewFields> \
                </GetListItems> \
            </soapenv:Body> \
        </soapenv:Envelope>";

    $.ajax({
        url: "_vti_bin/lists.asmx",
        type: "POST",
        dataType: "xml",
        data: soapEnv,
        complete: processResult,
        contentType: "text/xml; charset=\"utf-8\""
    });
});

function processResult(xData, status) {
    $(xData.responseXML).find("z\\:row").each(function() {
        var liHtml = "<a href='" + $(this).attr("ows_Title") + "'><img src='" + $(this).attr("ows_snapshot_file_location") + "' width=120 height=90><strong>" + $(this).attr("ows_video_description") + "</strong><br /><br />" + $(this).attr("ows_video_description") + "<em>" + $(this).attr("ows_video_length") + "</em></a><br />";
        glob.append(liHtml);
    });
}
</script>

and at the other part of the same document, I used

<script type="text/javascript">
document.write(glob);
</script>

and now, I receive the ‘undefined’ error. Any insight?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T00:47:28+00:00Added an answer on May 26, 2026 at 12:47 am

    Try –

    var glob = [];
    

    then –

    function processResult(xData, status) {
        $(xData.responseXML).find("z\\:row").each(function() {
            var liHtml = "<a href='" + $(this).attr("ows_Title") + "'><img src='" + $(this).attr("ows_snapshot_file_location") + "' width=120 height=90><strong>" + $(this).attr("ows_video_description") + "</strong><br /><br />" + $(this).attr("ows_video_description") + "<em>" + $(this).attr("ows_video_length") + "</em></a><br />";
            glob.push(liHtml);
        });
    }
    

    and for output –

    document.write(glob.join(""));
    

    That should build up a dynamic array of your html strings, that can be output via the array.join method. I think the problem with you original code is you’re using `append’ on a normal JavaScript variable when it is a jQuery specific function. Adding the content to a dynamic array should have the same effect.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would appreciate some advice on how to structure a database for the following
I'd appreciate some feedback on a particular approach I'm thinking of using. The scenario
I would appreciate some guidance on modelling services and operations in WCF. I have
I have a design issue that I would appreciate some input on. I would
I'm having some weird issues with dynamically populating a table in Javascript. Behold the
I appreciate that there are now many mechanisms in dotnet to deal with XML
I would really appreciate any suggestions, no matter how simple or complex, to help
I'd appreciate people's thoughts on a dilemma I've been struggling with ever since ASP.NET
I have an interesting problem and would appreciate your thoughts for the best solution.
I'm new to regular expressions and would appreciate your help. I'm trying to put

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.