I have session invalidation code which will invalidate a user’s session if he is idle for some time. Before invalidating the session I have to show a Jquery dialog box 1 minute before invalidating and ask the user if he wants to continue or logout.
Below is part of the code I have,
$j("#dialog").dialog({
buttons: {
'Yes, Continue': function()
{
$j.ajax({
url: 'http://myDomain/session_extend.jsp',
Whatever code I have is working fine.
Problem is, I have 3 environments (Development, testing & Production). This code is there in my web application. Everytime there is a code change it has to be moved to Development, testing and Production. And everytime I need to change the domain in the above URL and deploy in respective environments.
Is it possible to take the URL value from some property file? Or are there any other means to solve my problem?
You can get your host name by using javascript like
and you can pass this
pageUrlin ajaxurllikeI hope, It will help.