- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-24-2015 08:55 AM
Hi everyone,
I am using length() & trim() in client script, but receiving this error. Please suggest how to work on this.
Regards,
Lakshmi Patel
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-25-2015 02:43 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-25-2015 11:43 AM
My pleasure
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-25-2015 03:39 AM
Hi Lakshmi
When you get an error like this, it suggests that the answer object is null (be aware that the actual error can vary from browser to browser). Meaning that there is most likely no response being received from your Ajax response.
You could include some code to prevent the error, for example
if (answer) {
if (answer.length == 15) {
//... code comes here
}
}
or even
if (answer && answer.length == 15) {
//... code comes here
}
Either way, you need to test the answer object. So alerting the value of answer would be a good step to see if you are getting a response.
However this is only a workaround. If you don't have a result being returned when you are expecting to, then you would need to shift your debugging to the respective server-side code (most likely a Script Include). Add some gs.log() statements and use Session Debug to inspect what is happening (or not happening) during its execution.
While I'm here, is there a reason why you are doing this synchronously? Should you get this working and end up bringing back a big response, this will cause the browser to lock up. Would it be too much to follow the guidance of using GlideAjax - ServiceNow Wiki (so don't make it synchronous)?
Regards
Shahid