My Code:


    var itemProperties = {
        '__metadata': { "type": "SP.List" },
        "Title": FirstName  


         url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/getbytitle('ChangeOfAddressList')/items",
        type: "POST",
        contentType: "application/json;odata=verbose",
        data: JSON.stringify(itemProperties),
        headers: {
            "Accept": "application/json;odata=verbose",
            "X-RequestDigest": $("#__REQUESTDIGEST").val()
        success: function (data) {
        error: function (data) {

I get "FirstName is not defined" in chrome debugger. Everything else seems to work as it does actually reach the list it just can't populate it with anything meaningful This is all triggered by a submit. The id of the input is "name"

  • Because you are treating FirstName as a function, do you mean "FirstName"? – Eric Alexander May 4 '16 at 16:13
  • Yep, You are right, however, instead of inputting the <input type="text" id="FirstName"/> it just put in the text "FirstName". Just need to figure that out and Illl go home – Stacker May 4 '16 at 16:21

Based on your comment response, you'd do it like:

var itemProperties = {
    '__metadata': { "type": "SP.List" },
    "Title": $("#FirstName").val();

  • Cheers, It worked except I just had to remove the ; at the end. – Stacker May 4 '16 at 16:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.