Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Announcing the newest addition to the Qlik Community, Qlik Gallery! Learn More
Highlighted
Chanty4u
Esteemed Contributor III

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
MVP & Luminary
MVP & Luminary

Re: qlik Javascript

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


talk is cheap, supply exceeds demand
Chanty4u
Esteemed Contributor III

Re: qlik Javascript

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.

MVP & Luminary
MVP & Luminary

Re: qlik Javascript

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
MVP & Luminary
MVP & Luminary

Re: qlik Javascript

Will a javascript macro have access to the DOM?

$.ajax(


-Rob

MVP & Luminary
MVP & Luminary

Re: qlik Javascript

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
MVP & Luminary
MVP & Luminary

Re: qlik Javascript

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

-Rob