Hi everyone, I'm new to RESTlet and I have read a lot of information from here. Now I tried to create a html page that calls RESTlet upon opening it from my external server. Unfortunately I couldn't make a call to RESTlet. I knew it failed because I didn't see any debugging message under the Execution log at all.
Hope someone could help with the script. // Thanks
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" ></script>
<script type="text/javascript">
$(document).ready(function () {
var url = 'https://rest.netsuite.com/app/site/hosting/restlet.nl?script=328&deploy=1';
$.ajax({
type: 'GET',
url: url,
headers: {'Authorization':'NLAuth nlauth_account=123456, nlauth_email=myemail@mydomain.com, nlauth_signature=mypassword, nlauth_role=3', 'Content-Type':'application/json'},
success: function(data) {
alert('success: ');
},
error: function (request, status, error) {
alert('error: ');
//console.log(error);
}
});
});
</script>
</head>
<body>
<div><h2>Testing RESTlet</h2></div>
<button>Change Content</button>
</body>
</html>
/**** RESTlet script******/
{
var ENABLE_DEBUG = true;
}
function sayhi()
{
if (ENABLE_DEBUG) nlapiLogExecution('debug','RESTlet','<---START HERE--->');
var text ='Hello from RESTlet'
if (ENABLE_DEBUG) nlapiLogExecution('debug','RESTlet','<---END HERE--->');
return text;
}