Wednesday, October 14, 2015

Two dimensional array in jQuery


Code:
<script src="../_layouts/15/JQuery/mainjq.js" type="text/javascript"></script>


Keypoints:
1. mail_details array declartion
2.dynamically added list items 

<script type="text/javascript">
    $(document).ready(function () {
        try {
var mail_details = new Array();
var kl=0;
 $().SPServices({
                operation: "GetListItems",
                async: false,
                listName: "Mail",
                CAMLQuery: query,
                completefunc: function (xData, Status) {
                    $(xData.responseXML).find("z\\:row,row").each(function () {
                     
                        mail_details[kl] = new Array(8);
                        mail_details[kl][0] = $(this).attr("ows_ID");
                        mail_details[kl][1] = $(this).attr("ows_Date");
kl = kl + 1;
                    });
                }
            });
  } catch (e) {
            alert("Ready Error:" + e);
        }
     
    });

No comments:

Post a Comment