Root Cause: You might have using wrong object creation in SharePoint App.
Ex: var ccontext = SP.ClientContext.get_current();
Solution:
Use below code.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var objContext = new SP.ClientobjContext.get_current(); | |
var objWeb = objContext.get_web(); | |
var objList = objWeb.get_lists().getByTitle('MyList'); | |
var objListItemCreation = new SP.ListItemCreationInformation(); | |
var objNewItem = objList.addItem(objListItemCreation); | |
objNewItem.set_item('Title', "Welcome"); | |
objNewItem.update(); | |
objContext.load(objNewItem); | |
objContext.executeQueryAsync(alert('Success'), alert('fail')); |