How to Push AJAX array response into an js array
<p><strong>On a AjAX call , i am getting data</strong> </p>

<pre><code>success : function(data){
               alert(data);
         }
</code></pre>

<p><strong>This is the result of that alert</strong></p>

<pre><code>[/files/1.jpg,/files/2.jpg,/files/3.jpg]
</code></pre>

<p><strong>I want to push this result into a javascript array</strong> </p>

<pre><code> var outputdata = [];
</code></pre>

<p>Where the array outputdata should look like </p>

<pre><code> var outputdata = [/files/1.jpg,/files/2.jpg,/files/3.jpg];
</code></pre>

<p>I tried this way </p>

<pre><code>success : function(data){
               alert(data);
outputdata.push(data);

         }
</code></pre>

<p>Updated Part</p>

<p>I tried with yours as wel as with this </p>

<pre><code>success: function(data) {
                $.each(data, function(i) {

                    outputdata.push(data[i]);
                });
                alert(outputdata);

                outputdata.forEach(function (element) {

                      content = "&lt;div&gt;&lt;a href='#'&gt;&lt;img src=" + element + "   /&gt;&lt;/a&gt;&lt;/div&gt;";
                     $("#container").append(content);
                    });

            }
</code></pre>

<p><img src="http://i.stack.imgur.com/KyhBc.png" alt="enter image description here"></p>

<p>The initial alert data is fine (I mean initial means )</p>

<pre><code>success: function(data) {

             alert(data);

                $.each(data, function(i) {

                    outputdata.push(data[i]);
                });
                alert(outputdata);
</code></pre>

<p>See the Picture of initial alert</p>

<p><img src="http://i.stack.imgur.com/t2sTM.png" alt="enter image description here"></p>
