如何在jquery中将变量值传递到url

如何在jquery中将变量值传递到url,jquery,Jquery,我试图将变量值传递到url中,但无法传递,在警报中,我获得了值,但当我将相同的变量放入url中时,该值未被接受 i have tried in the following way: code: ---------------------- {!REQUIRESCRIPT('/soap/ajax/26.0/connection.js')} {!REQUIRESCRIPT('/js/functions.js')} {!REQUIRESCRIPT('/resource/

我试图将变量值传递到url中,但无法传递,在警报中,我获得了值,但当我将相同的变量放入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');
我尝试了以下方法:
代码:
----------------------
{!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/jqueryforpoup/jQuery/postmessage/jQuery.ba postmessage.js'))
{!REQUIRESCRIPT('/resource/jQueryForPopup/jQuery/bbq/jQuery.ba bbq.min.js'))
requirecsfile('/resource/jQueryForPopup/jQuery/ui/css/ui lightness/jQuery-ui-1.9.1.custom.min.css');
函数requirecsfile(文件名)
{ 
var fileref=document.createElement('link');
setAttribute('rel','stylesheet');
fileref.setAttribute('type','text/css');
fileref.setAttribute('href',文件名);
} 
警报(“hi”);
var j$=jQuery.noConflict();
警报(“hi1”);
var param=“{!customobj__c.Id}”;
警报(参数);
var iframe_url='{!URLFOR(“/apex/pagename?id=param”)}';
警报(iframe_url);
变量j$modalDialog=j$(“”)
.html(“”)
.dialog({
自动打开:错误,
自动关闭:是的,
可调整大小:正确,
宽度:300,
身高:100,
自动调整大小:正确,
莫代尔:是的,
德拉格布尔:是的
}); 
j$modalDialog.dialog(“打开”);

您将'param'变量保留在双引号(“)中,因此它被视为字符串文字而不是变量

您需要按以下方式将变量从双引号中拆分出来:

var iframe_url = '{!URLFOR("/apex/pagename?id="+param)}';

var iframe_url='{!URLFOR(“/apex/pagename?id=“'+param+”)}”;即使没有任何用处,也可以尝试此操作