whatever you are using to send the request is refu...
# suitescript
b
whatever you are using to send the request is refusing to communicate with NetSuite
n
var purl = 'https://XXXXXXX.restlets.api.netsuite.com/app/site/hosting/restlet.nl?script=XXXXXX'; var headerParams = {'Authorization': 'NLAuth nlauth_account=XXXXXXX,nlauth_email=XXXXXX.com, nlauth_signature=XXXXXXX,nlauth_role=XXXXX', 'Content-Type': 'application/json'}; $.ajax({ type: 'POST', url: purl, headers: headerParams, data: XXXXXXX, success: function(pdata){ console.log(pdata); }
This is the request I am generating
b
that looks like browser javascript
browsers won't let you send requests outside of the server the page you are running the javascript on
its a security issue
CORS is a way to work around that by relating 2 different servers
n
So if I update the headers while making the call will it work Like adding the header which will allow all the domains
b
netsuite wont allow you to set those headers
n
Or is this something which is caused on Netsuite end.
b
or its not supposed to, you can try seeing if a suitelet will let you set those headers
n
Yes Suitlet does let me set those headers but will i have to make the suitelet public?
b
yes
you can try implementing some sort of authentication
but you generally throw security out the window if you are sending credentials via the browser
m
I don't believe you can set CORS headers with a suitelet either. I had to work around it with jsonp.
n
@michoel I want to get the result of search. Is there a document you can point me to so that I can look into it.
n
@michoel and @battk Thank you so much for your help simple smile