Calling array through an alert

kunal16
Tera Expert

I have wrote a script include for an array outcome. I am calling the same script include through a client script. What I need is to get an alert/pop-up alert to display the result of the same array. How can that be achieved?

1 ACCEPTED SOLUTION

Hi Kunal,



Instead of alerting it in the loop just add it and display it after the loop's finished:



  1.   function _processResponse(response) {
  2.           var userAttributes = response.responseXML.getElementsByTagName("userAttributes"),
  3.                   sStringToAdd = "",
  4.                   sAnswer = "";
  5.           for (var i=0; i<userAttributes.length; i++){
  6.                       sStringToAdd = i<userAttributes.length - 1 ? userAttributes[i].getAttribute("value") + "," : userAttributes[i].getAttribute("value") + "";
  7.                       sAnswer += sStringToAdd;
  8.           }
  9.           alert(sAnswer);
  10.   }


Cheers



Greg


View solution in original post

11 REPLIES 11

Thank you so much Greg! It worked!!! Appreciate your help


Can you reproduce this in any demo instance so that I can take a look?