Ajax errors in Nintex Forms O365

  • 26 April 2021
  • 1 reply
  • 88 views

Hi,

 

I am new to Nintex forms O365 classic designer. Actually we are doing migration from SharePoint on premise to Online.

In our On-Prem, we are have custom forms and developed using JavaScript. So when I am trying to use the ajax calls code in Online they are throwing error.

Like for "_spPageContextInfo.webAbsoluteUrl" is throwing error "Uncaught TypeError: Cannot read property 'webAbsoluteUrl' of undefined"
I tried hard coded with my online site in place of weburl, but it is throwing error,  forbidden 403 error at ajax url.

 

So, I followed the solution in the blow forum
https://community.nintex.com/t5/Nintex-for-Office-365-Forum/How-do-I-call-SharePoint-2013-Rest-APIs-from-Nintex-Form/td-p/35104

Here the solution is having success and error methods, but I need the latest methods done and fail.

 

So can you please help me to how to use my existing code ajax call with done and fail methods. Do I need to use any reference jQuery files in order to use my old On-Prem JavaScript code.

 

Thanks,
Kishore.


1 reply

Userlevel 4
Badge +10

Hi,


You are on an SharePoint App, and so, you are not directly in your SharePoint site (nintex is a Hosted App), So the JavaScript Object _spPageContextInfo don't exist on your classic form.


For your error forbidden 403 error, you don't have the formDigest on your page, so when you will send your REST query, you will not have your authentication token (formDigest), that why you have an 403 error.


 


The Jquery is already embeed in the Nintex classic form, it's just renamed by : NWF$


 


To make query to you SharePoint site I recommand to use the SP.RequestExecutor like the exemple, you will need to re-write some part of your code 😉


 

Reply