Update data through Ajax
<p>I have the below code on href click I'm calling a javascript code in which an ajax is being called which returns the value of array <code>$ss</code> in json format . Now I want to know how can I update the value of $ss via ajax.</p>

<pre><code> &lt;div class="white" id="white" style="display:none"&gt;   
        &lt;?php
            foreach ($ss as $key =&gt; $value){
        ?&gt;
        &lt;a  href='javascript:void(0);'  onclick='callAjax('&lt;?php echo $key; ?&gt;')'&gt;
        &lt;?php   
           echo $value;
        ?&gt;
        &lt;/a&gt;
        &lt;?php
           }
        ?&gt;

&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"&gt;&lt;/script&gt;
    &lt;script&gt;
        var res;
        function on(id){
            //alert('hi '+id);
            $.ajax({
                url: 'ajax.php', //This is the current doc
                type: "GET",
                data: ({a: id }),
                success: function(data){
                    res = data;
                    //alert(res);
                    document.write(res);
                }
            }); 

        }

    &lt;/script&gt;
</code></pre>

<p>And ajax.php files return array values for $ss.
I understood how to update data of normal div through ajax but encountering problem to pass the data returned by ajax call to update array value.</p>