Custom Module AJAX URL
Jamroom Developers
Goal : Custom Module POST via AJAX to correct URL
--
Searching thru JR code, we find many examples of .ajax - all seem to build .ajax URL in a similar manner:
var url = core_system_url + '/' + jrProfile_url + '/get_pulse_counts/__ajax=1';
$.ajax({
type: 'GET',
url: url,
dataType: 'json',
cache: false,
success: function(n)
{
if (cb !== null && typeof cb == "function") {
cb(n);
}
}
});
Question:
1) Where do these values "core_system_url", "jrProfile_url" get set? Are similar vars available by default to custom modules?
var url = core_system_url + '/' + jrProfile_url + '/get_pulse_counts/__ajax=1';
2) In code above, how does JR Custom Module framework implement the last param "__ajax=1"
3) How do Custom Modules build the correct .ajax URL in JS?
--
This is not a general code question, we are fluent with php, ajax, js code, etc...
--
This question is about how to implement .ajax correctly inside the JR Custom Module framework. Specifically how to correctly set the .ajax URL in the JS of a custom module.
Please Advise...
updated by @softdesigns: 07/23/17 11:41:24AM