- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2014 01:21 PM
So here is what we are trying to do, we have built a new application that uses a processor because of js_includes conflicts when using UI pages. The app works great and it's nice because it doesn't come with all the includes and additional markup thats get jammed into a UI page.
So now, since js_includes and prototype is not available on the page... how do I make a GlideAjax call? Or can I mimic a GlideAjax call using jQuery Ajax?
I can already use the JSONv2 API to access all data client side, but being able to call Script Includes would be great.
Any thoughts or suggestions would be greatly appreciated.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2015 07:17 PM
You can use jQuery.ajax, but you'll need the g_ck token to go along with it. Here's an quick example of how I run mine:
jQuery.ajax({
url: 'xmlhttp.do',
data: {
sysparm_processor: 'ScriptIncludeName',
sysparm_name: 'MethodName',
sys_id: 'ParameterValue',
table: 'ParameterValue'
},
headers: {
'X-UserToken': g_ck
},
success: function(response) {
console.log('received ' + response)
}
});
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2014 03:57 AM
Hi Nathan,
I may be wrong but I don't think from a processor you would use the GlideAjax. Instead you could do one of two things (well one of two things I know how to do. there could be more...).
- if you need interaction between scripts and script includes you would extend your script include as an AbstractScriptProcessor and when you call it in the processor pass in the arguments g_request, g_response, and g_processor. Using those parameters you can pass info to other script includes or scripts you call within your AbstractScriptProcessor script. For an example a script include would look like this:
var MyTestProcessor = Class.create();
MyTestProcessor.prototype = Object.extendsObject(AbstractScriptProcessor, {
process : function() {
//....more code using this.request, this.response, this.processor
},
});
and the processor looks like this:
Path: myproc <----------(form field named path. This is the path to call your processor)
Script:
var doMyProc = new MyTestProcessor(g_request, g_response, g_processor); <---oops. This is an edit. my original post I forgot the arguments.
doMyProc.process();
Or
2. You can just use a regular script include and output the data from that.
I'll be busy this weekend but on Monday if you have the time give me a call and I'll show you some working examples.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2015 07:17 PM
You can use jQuery.ajax, but you'll need the g_ck token to go along with it. Here's an quick example of how I run mine:
jQuery.ajax({
url: 'xmlhttp.do',
data: {
sysparm_processor: 'ScriptIncludeName',
sysparm_name: 'MethodName',
sys_id: 'ParameterValue',
table: 'ParameterValue'
},
headers: {
'X-UserToken': g_ck
},
success: function(response) {
console.log('received ' + response)
}
});
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2015 10:50 AM
That's awesome, thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2016 04:22 AM
Hi,
im not able to make call to my script include.. can you tell what is sys_id and table. are they mandatory arguments?
thanks,
Rushit Patel