Forum

moodle, how to logo...
 
Notifications
Clear all

moodle, how to logout from external script?

1 Posty
1 Users
0 Reactions
1,448 Widok
0
Topic starter

ajax, jquery

1 Answer
0
Topic starter

1. add to .htaccess

1
Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Origin "*"

2.

1
2
3
4
5
6
7
8
9
10
11
    $(document).ready(function () {
        $.ajax
        ({
            type: 'POST',
            url: 'https://moodle.my.site.com/login/logout.php',
            data: {sesskey: "MY_METHOD_TO_GET_SESSION_KEY()"},
            xhrFields: {
                withCredentials: true
            }
        });
    });
    $(document).ready(function () {
        $.ajax
        ({
            type: 'POST',
            url: 'https://moodle.my.site.com/login/logout.php',
            data: {sesskey: "MY_METHOD_TO_GET_SESSION_KEY()"},
            xhrFields: {
                withCredentials: true
            }
        });
    });

Odpowiedź

Author Name

Author Email

Your question *

 
Preview 0 Revisions Saved
Share: