I need some help with string building and concatenation in JavaScript.
I have a form on a website where a user inputs a VIP name which is then added to the end of my URL to build a dynamic dashboard.
My code:
$(window).on('load', function() {
$('#open').click(function() {
var fixedData1 = 'http://testwebsite/dashboard/db/omni-vip?var-vip=',
userEntry1 = $('#one').val();
var newWindow = window.open(fixedData1 + userEntry1);
newWindow.focus();
});
});
Example. User enters.... app-123.network.dcs1.domain.com
which would then open a new page with the URL:
http://testwebsite/dashboard/db/omni-vip?var-vip=app-123.network.dc.domain.com
This is great and works fine, however I want to make the 'DC' part a variable, I have two DC's dcS1/dcS2 at the moment a user would enter like the above and specify the dc in the name. This only opens a dashboard with that particular dc.
I want to be able to pass the VIP name with the dc as a variable, so
vip=app-123.network.$dc.domain.com
even if it is entered with a specific named dc by the user.
If this even possible? I don't know where to begin.
Thaks