You need to sign in to do that
Don't have an account?
PC
pass a variable in a new window url
I have a variable 'd' that captures the current date time.
In the same page i have a button inside jquery which is redirecting to a new page in new window.
I want to pass the variable d in the url.
Code:
var d = new Date();
The url is : '<a href="/apex/vfp_KOT?oid=" class="js-newWindow" data-popup="width=500,height=600"><button type="button" class="btn btn-primary">Print KOT</button></a> '+
New Window :
$(document).ready(function(){
$('.js-newWindow').click(function (event) {
event.preventDefault();
var $this = $(this);
var url = $this.attr("href");
var windowName = "popUp";
var windowSize = $this.data("popup");
//alert($.session.get('sessionoid'));
var noid = $.session.get('sessionoid');
var urlnew = url+noid;
window.open(urlnew, windowName, windowSize);
});
});
In the same page i have a button inside jquery which is redirecting to a new page in new window.
I want to pass the variable d in the url.
Code:
var d = new Date();
The url is : '<a href="/apex/vfp_KOT?oid=" class="js-newWindow" data-popup="width=500,height=600"><button type="button" class="btn btn-primary">Print KOT</button></a> '+
New Window :
$(document).ready(function(){
$('.js-newWindow').click(function (event) {
event.preventDefault();
var $this = $(this);
var url = $this.attr("href");
var windowName = "popUp";
var windowSize = $this.data("popup");
//alert($.session.get('sessionoid'));
var noid = $.session.get('sessionoid');
var urlnew = url+noid;
window.open(urlnew, windowName, windowSize);
});
});
Try this :
$(document).ready(function(){
$('.js-newWindow').click(function (event) {
event.preventDefault();
var $this = $(this);
var url = $this.attr("href");
var windowName = "popUp";
var windowSize = $this.data("popup");
//alert($.session.get('sessionoid'));
var noid = $.session.get('sessionoid');
var urlnew = url+noid+'?dateValue=' + d;
window.open(urlnew, windowName, windowSize);
});
});
I tried this code...but it is not working....after modifying to this...the button is not clickable
Hi, Puja Choudhary
Use this code to pass the parameter in param1 variable
along with address of next page , in this case a vf page BankingTransaction
Note use any of 2 url style
1. String url='https://c.ap5.visual.force.com/apex/BankingTransactionManagement?core.apexpages.request.devconsole=1¶m1='+ yourParameter;
in above if url has ? symbol in it already use & symbol to join parameter
2. String url='https://c.ap5.visual.force.com/apex/BankingTransactionManagement?param1='+ yourParameter;
if url has no ? symbol then add ? and parameter
Please set as best answer if it works for you
Can you suggest me something that can be done in my code.....also I want the new page to open in a new window.
window.location.href = "http://www.gorissen.info/Pierre/maps/googleMapLocation.php?lat="+elemA+"&lon="+elemB+"&setLatLon=Set";
If I change the code in the below line like:
<a href="/apex/vfp_KOT?datetime=+d+&oid=" class="js-newWindow" data-popup="width=500,height=600"><button type="button" class="btn btn-primary">Print KOT</button></a>
The value of "d" is not coming....Is there any problem in the syntax?