我正在尝试将变量值传递到url但无法传递,在alert中我得到了值,但是当我将相同的变量放在url中时值没有。
i have tried in the following way:
code:
----------------------
{!REQUIRESCRIPT('/soap/ajax/26.0/connection.js')}
{!REQUIRESCRIPT('/js/functions.js')}
{!REQUIRESCRIPT('/resource/jQueryForPopup/jQuery/jquery-1.8.2.min.js')}
{!REQUIRESCRIPT('/resource/jQueryForPopup/jQuery/ui/jquery-ui-1.9.1.custom.min.js')}
{!REQUIRESCRIPT('/resource/jQueryForPopup/jQuery/postmessage/jquery.ba-postmessage.js')}
{!REQUIRESCRIPT('/resource/jQueryForPopup/jQuery/bbq/jquery.ba-bbq.min.js')}
requireCssFile('/resource/jQueryForPopup/jQuery/ui/css/ui-lightness/jquery-ui-1.9.1.custom.min.css');
function requireCssFile(filename)
{
var fileref = document.createElement('link');
fileref.setAttribute('rel', 'stylesheet');
fileref.setAttribute('type', 'text/css');
fileref.setAttribute('href', filename);
}
alert('hi');
var j$ = jQuery.noConflict();
alert('hi1');
var param = "{!customobj__c.Id}";
alert(param);
var iframe_url = '{!URLFOR("/apex/pagename?id=param")}';
alert(iframe_url);
var j$modalDialog = j$('<div id="opppopup"></div>')
.html('<iframe id="iframeContentId" src="' + iframe_url + '" frameborder="0" height="100%" width="100%" marginheight="0" marginwidth="0" scrolling="no" />')
.dialog({
autoOpen: false,
autoclose: true,
resizable: true,
width: 300,
height: 100,
autoResize: true,
modal: true,
draggable: true
});
j$modalDialog.dialog('open');
答案 0 :(得分:0)
你保留了&#39; param&#39;双引号内的变量(&#34;)因此被认为是字符串文字而不是变量。
您需要以下面的方式从双引号中拆分变量:
var iframe_url = '{!URLFOR("/apex/pagename?id="+param)}';