I have two lists :one has look up field to the other when i use code below to insert listitem it just insert value in title field and doesn't insert in the look up value i have two fields called :'title' and 'myLookup'
$.ajax({
url: myurl+"/_api/web/lists/GetByTitle('mylist')/items",
type: "POST",
data: JSON.stringify({
__metadata: { "type": 'SP.Data.mylistListItem' },
Title: "value",
'myLookupId': 34 //existing id,
}),
headers: {
"accept": "application/json;odata=verbose",
"content-type": "application/json;odata=verbose",
"X-RequestDigest": $("#__REQUESTDIGEST").val()
},
success: function (d) {
alert("Items Inserted!");
//window.location.href=referrer;
},
error: function (err, result) {