Ajax action ” Finish Course” customization
-
When user completes a course , need to send API call to external platform. Already inserted API call that passes email address of the user and everything is working fine. Right now i am using hardcoded email for testing but need to get current user email and insert it as a variable. Because of Ajax call, i am not able to figure out how to get email of that user using standard wordpress function for user data. Does Learnpress already have some function to get user email inside js file?
single-course.js
……
finishCourse: function (args) {
var that = this;
LP.ajax({
url : this.get(‘url’),
action : ‘finish-course’,
data : args.data,
dataType : ‘json’,
beforeSend: function () {
LP.blockContent();
},
success : function (response) {
LP.unblockContent();LP.ajax({
url: ‘https://somedomain.com/api/Profile/setCourseCompleted?email=’+’[email protected]’+’&secretKey=xxx-xxxx-xxxx-xxxx’,
type: ‘GET’,
success: function(data){
alert(data);
}
});learn_press_update_item_content
$.isFunction(args.callback) && args.callback.call(args.context, response, that);
}
});
….
- The topic ‘Ajax action ” Finish Course” customization’ is closed to new replies.