Skip to main content
5 votes

AJAX Pass variable to successhandler

Robs answer works, But you might as well move the whole function inside the addList scope (unless the function is called from other functions as well) The JavaScript .bind() method is the JS way of ...
Danny '365CSI' Engelman's user avatar
5 votes

AJAX Pass variable to successhandler

function addList() { var something = "ABC"; getData(url).success(function(data) { successHandler(data, something); }); } function successHandler(data, something) { console....
Rob Windsor's user avatar
  • 12.7k
5 votes

Getting this error: An entry without a type name was found, but no expected type was specified

When making a POST request, __metadata attribute isn't required if aren't passing the Accept:"application/json;odata=nometadata" header. If you are passing in a verbose header you would need to ...
Edison Neza's user avatar
5 votes

Getting this error: An entry without a type name was found, but no expected type was specified

I think this occurs due to missing Type attribute in List Item entry. If you want to create list items using REST you will need to include the list item type. The list item type is a string ...
Sylvain B's user avatar
  • 260
4 votes
Accepted

Get item count in a list with filter

The problem is $count return a plain text not a json so you call should be change from: headers: { "Accept": "application/json; odata=verbose" } To headers: { "Accept": "text/plain;odata=verbose" } ...
Marco's user avatar
  • 1,044
4 votes
Accepted

update sharepoint list using jQuery and ajax

How to update List Item via SharePoint REST interface function updateJson(endpointUri,payload, success, error) { $.ajax({ url: endpointUri, type: "POST", data: ...
Nderon Hyseni's user avatar
4 votes

Failed to load resource: the server responded with a status of 500 (Internal Server Error)

First: To really troubleshoot the very generic "500 (Internal Server Error)" error, you'd need to get access to the server ULS logs, or attach a debugger to w3wp.exe. 500 only means a basic error has ...
Evariste's user avatar
  • 9,731
4 votes
Accepted

Failed to load resource: the server responded with a status of 500 (Internal Server Error)

Based on the chat conversion, we have tried to trace the root cause of 500 internal server error and finally, we found out the OP has used SOAP web service, so it should return XML instead of json ...
Mohamed El-Qassas MVP's user avatar
4 votes

Getting assign to by rest

The AssignTo field is people/group field so we need to expand the field to get information from the field and in rest we need to specify the internal name of the field not the display name example in ...
Sunil Sahu's user avatar
  • 1,768
4 votes
Accepted

Rest API Post Request Returns '403 Forbidden'

You can directly use the FormDigestValue in the RequestDigest header in Modern pages. The __REQUESTDIGEST is a hidden HTML element which is not present in modern pages. So, it had tripped up your ...
Gautam Sheth's user avatar
  • 30.9k
4 votes
Accepted

How to use SharePoint REST API to get newest list item?

The URL and endpoint seems right. But in success, you will get the return data in data.d.results array. So you can extract the ID of item from data.d.results array. In this case, You will not get ...
Ganesh Sanap - MVP's user avatar
3 votes
Accepted

REST Add List Item of Custom Content Type

You don't have to deal with __metadata. Just specify your ContentTypeId in your request body and that's all. data: JSON.stringify({ __metadata: { "type": "SP.Data....
Atish Kumar Dipongkor's user avatar
3 votes
Accepted

Connected Visual Webpart - RegisterAsyncPostBackControl is not working?

Credit goes to @KenHansen, Updated the code as below and it works <td> <asp:UpdatePanel ID="btApplyFilterPanel" runat="server"> <ContentTemplate> ...
Karthikeyan's user avatar
  • 2,548
3 votes
Accepted

displaying ajax query results in usable format

Ok, so I think it's a little easier to see the structure if you open your browser tools and do console.log(data.d.results) instead of alert (no need for JSON.stringify). Where you see the square ...
Dylan Cristy's user avatar
  • 12.8k
3 votes
Accepted

Corrupt or blank file when downloaded from Sharepoint using rest API ajax call javascript

As we have seen in this problem, mentioning responseType :'arraybuffer' or responseType :'blob', or using 'binaryStringResponseBody:true' didn't help. In all cases we were getting the response but it ...
UBK's user avatar
  • 1,213
2 votes

Why can't my value pass through JSON to SHarepoint list?

Two things: Your metadata type is wrong. It should be SP.Data.ChangeOfAddressListListItem. The format is SP.Data.(list name)ListItem or SP.Data.(library name)Item when adding or updating an item. You ...
Rob Windsor's user avatar
  • 12.7k
2 votes

REST + SharePoint Online: Update Single User Lookup Field to null

Make sure the user field value is specified as <FieldName>Id: null in request, for example: url: <webUrl>/_api/web/lists/getbytitle('<listTitle>')/items(<itemId>) method: ...
Vadim Gremyachev's user avatar
2 votes

XMLHttpRequest cannot load error

Browser is not allowing you to access service which is published on different domain. following is link of tutorial of how to access cross domain service. http://www.html5rocks.com/en/tutorials/cors/...
Akshay Belure's user avatar
2 votes

REST Gel all folders/subfolders and files in tree view using Ajax

Try /_api/web/Lists/GetByTitle('Documents')/Items?$select=FileLeafRef,FileRef You will have to built the correct tree structure yourself
Danny '365CSI' Engelman's user avatar
2 votes
Accepted

AJAX get for this weeks birthdays

i'd suggest using momentjs and calculating the exact date that you need for each, then query rest based on that. somethings like var monday = moment().startOf('week').add(1, 'days'); //beginning of ...
Mike's user avatar
  • 12.2k
2 votes

AJAX Rest get currency format

Whenever we are retrieving values for Currency column, it only returns its value in Numeric format but doesn't returns Currency Type. As we know a Currency column can be set to contain only one type ...
Yayati's user avatar
  • 1,738
2 votes
Accepted

Unable to retrieve list items using REST JSON (using jQuery.slim)

The issue lies with your jQuery file. Use either of the below jquery references - 1) https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js or 2) https://cdnjs.cloudflare.com/ajax/libs/...
Gautam Sheth's user avatar
  • 30.9k
2 votes
Accepted

Get document URL via Ajax

You need to add the EncodedAbsUrl field in the select fields. You can add all the fields that you want using the internal column names. So, modify your endpoint as below: url: "XXX_api/web/lists/...
Gautam Sheth's user avatar
  • 30.9k
2 votes

How to update Values in Sharepoint list using ajax

function CreateListItemWithDetails(listName, webUrl, newItemTitle, success, failure) { var itemType = GetItemTypeForListName(listName); var item = { "__metadata": { "type": itemType }, ...
SharePointMan's user avatar
2 votes
Accepted

Submitting input from HTML Form to a SharePoint list without using Infopath

Found the answer on this page. Thanks for your input. It appears that the error occurs because the form digest has been expired on the page. so i used these functions var webUrl = "https://weburl" ...
ShanayL's user avatar
  • 151
2 votes
Accepted

AJAX: the server responded with a status of 500 (Internal Server Error)

It's a SOAP Service, so try sending XML instead of JSON. Something like: $.ajax({ url: "/_layouts/15/Load5MoreComments/CommentFetchSvc.asmx", type: "POST", dataType: "xml", beforeSend: ...
AymKdn's user avatar
  • 1,189
2 votes

Connected Visual Webpart - RegisterAsyncPostBackControl is not working?

I guess I should have posted as an answer rather than a comment in order to claim the bounty... Thank you. I see that the button calls btApplyFilter_Click, but I don't see what that does. It ...
Ken Hansen's user avatar
2 votes

IE8 doesn't work

Inserting <!DOCTYPE html> in the masterpage/publishing page forces HTML5 to be rendered -- which IE8 does not support.
Mike's user avatar
  • 12.2k
2 votes
Accepted

JSOM Break SharePoint List Item Permission

This is because your function getCurrentUser() has an async operation (executeQueryAsync). JS does not wait for it to complete and executes the next line i.e. console.log(user). You need write the ...
Naveen's user avatar
  • 1,912
2 votes
Accepted

upload file to SharePoint Online via REST API issue

Edit: On second thought, first thing to try might be wrapping the URL with single quotes: url='{1}'. Original answer: Try removing the space from inside the add function. From my experience, the ...
Richard Li's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible