Click here to Skip to main content
16,021,823 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
JavaScript
function Submit(payload) {
    let arry = [];
    for (let x = 0; x < payload.Idetails.length; x++) {
        
        .success(data)
           {
            arry.push(data);
           }
    }
    console.log(JSON.stringify(arry));
    
}

data would be json
JSON
{"type":"success","key","123","Id":"1234"}

I want to save list of json
JSON
{"type":"success","key","a12","Id":"1234"}
{"type":"success","key","ab3","Id":"1245"}
{"type":"success","key","d11","Id":"1256"}
{"type":"success","key","eff","Id":"12378"}


What I have tried:

on success return am just saving json return data in resultArry.push(data)
but its not working.
Need help on this.
Posted
Updated 26-Apr-23 4:15am
v4
Comments
Richard Deeming 26-Apr-23 8:17am    
REPOST
This is the same as the question you posted two days ago, just with less useful information in it:
How to use for loop in java script in ajax call to execute multiple iteration?[^]

The answer has not changed. And as I said, if the solution I posted doesn't do what you want, then you need to explain clearly and precisely what you want.
Salt Pepper 26-Apr-23 10:10am    
That is working properly Thanks for your reply Richard Deeming.
This question is completely different
On Each iteration on success, some response I will get. resultArry.push(data);
I need to keep it in list. finally i need to send list of data.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900