1

I have below array where i am appending values to string strOrderArr.

 var strOrderArr = '';
 $.each(uploadData, function (i, item) {
 strOrderArr = strOrderArr + "{";
 strOrderArr = strOrderArr + "'upld_contentlabel':" + "'" + item.label + "'" + ",";
 strOrderArr = strOrderArr + "'upld_DocumentName':" + "'" + item.DocName + "'" + ",";
 strOrderArr = strOrderArr + "'upld_docid':" + "'" + item.DocId + "'" + ",";
 strOrderArr = strOrderArr + "'upld_contentvalue':" + "'" + item.value + "'";
 strOrderArr = strOrderArr + "'upld_contentid':" + "'" + item.doc_contentid + "'";
 //strOrderArr = strOrderArr + "'TotalCost':" + "'" + $(item).find("#lblTotalAmt_" + row).text() + "'";
 strOrderArr = strOrderArr + "},";
 });

I want to append one more value to strOrderArr from other array

 $.each(Content, function (key, value) {
 strOrderArr=strOrderArr+value.doc_contentid;
});

Is this possible? I tried as above but values are not appending. So where i going wrong? Thanks in advance.

asked Aug 24, 2016 at 4:53
1
  • Read about JSON.stringify(OBJECT).. You have put so much efforts but they are not really needed... Commented Aug 24, 2016 at 4:56

1 Answer 1

1

var object1 = {
 apple: 0,
 banana: { weight: 52, price: 100 },
 cherry: 97
};
 
// Assuming JSON.stringify - not available in IE<8
$( "#log" ).append( JSON.stringify( object1 ) );
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
<div id="log"></div>

answered Aug 24, 2016 at 5:54
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.