Discussions
Stay up-to-date with the latest news from NetSuite. You’ll be in the know about how to connect with peers and take your business to new heights at our virtual, in-person, on demand events, and much more.
New AI Community Guidelines. Please review and follow them to ensure AI use stays safe, accurate, and compliant.
Simple Ajax/SuiteLet Example
I've create what I think is the simplest call to a SuiteLet. However, the Ajax return value is consistently null. I'm sure I'm missing something simple.
Here's both the client and server code:
//client: <script language="Javascript"> function xmlhttpPost(strURL) { var xmlHttpReq = false; var self = this; // Mozilla/Safari if (window.XMLHttpRequest) { self.xmlHttpReq = new XMLHttpRequest(); } // IE else if (window.ActiveXObject) { self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP"); } self.xmlHttpReq.open('POST', strURL, true); self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); self.xmlHttpReq.onreadystatechange = function() { if (self.xmlHttpReq.readyState == 4) { //updatepage(self.xmlHttpReq.responseText); alert('test '+self.xmlHttpReq.responseText); } } self.xmlHttpReq.send(); } </script> //server (SuiteLet): function demoList(request, response) { response.write('<b>yo baby</b>'); } 0