Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Chanty4u
MVP
MVP

qlik Javascript

Hi All,

Can anybody help me with the below code. I was using the below code for clearing the user session by a click on a button.

function clearSession()

{

($("#nb_logout").click(function () {

        var logoutURL = (config.isSecure ? "https://" : "http://") + config.host + (config.port ? ":" + config.port : "") + config.prefix + "qps/user";

        $.ajax({

            type: "DELETE",

            url: "http://kr.ks.kt.com/qlikview/Login.htm",

            contentType: "application/json; charset=utf-8",

            dataType: "json",

            success: function (response) {

                //var names = response.d;

                //var homeURL = (config.isSecure ? "https://" : "http://") + config.host + (config.port ? ":" + config.port : "") + config.prefix + "extensions/Overview/Overview.html";

                //console.log("Please relogin...");

                window.location = "http://kr.ks.kt.com/qlikview/Login.htm";

            },

            failure: function (response) {

                alert(response);

            }

        });

    }));

}

Please let me know what is wrong with the above code. i have posted the exact code except the domain name

6 Replies
Gysbert_Wassenaar

Perhaps this extension helps: Document Extension to Terminate an AJAX Session | Qlik Community


talk is cheap, supply exceeds demand
Chanty4u
MVP
MVP
Author

Thanks for the reply Gysbert.

In our case we need so many approvals for using the extensions so that will cause more delay. Can we have a javascript function called from a text object or button.

Gysbert_Wassenaar

Sure. That's possible. Simply write your macros in javascript instead of vbscript. Then add an Execute Macro action to your text box or button.


talk is cheap, supply exceeds demand
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Will a javascript macro have access to the DOM?

$.ajax(


-Rob

Gysbert_Wassenaar

I doubt it. But looking at the code of this extension it might be possible to open the document url with "&close=true" appended to the url to get the required result.


talk is cheap, supply exceeds demand
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

There is already a "Close" link on the browser screen. Will that do what you want?

-Rob