I have a code in jQuery as below:
$('.class').each(function(){
//Ajax call to create list item using REST API
url: http://site url/_api/web/lists/GetByTitle(‘Test')/items
method: POST
body: { '__metadata': { 'type': 'SP.Data.TestListItem' }, 'Title': 'Test'}
headers:
Authorization: "Bearer " + accessToken
X-RequestDigest: form digest value
accept: "application/json;odata=verbose"
content-type: "application/json;odata=verbose"
content-length:length of post body
})I have PreSaveAction() where above code is placed, my page gets redirected even before all the items are created.
Not able to solve it.
Please help.