English 中文(简体)
• 如何通过URL变量,在PHP中分类
原标题:How to pass URL variables to javascript in PHP

我需要将URL变量带入一个PHP网页,然后将其带入一些斜体,然后在网页上用超文本。 在此,我需要使用变量:

function dosubmit( ) {
new Ajax.Updater(  result ,  dial.php , { method:  post  , parameters: $( dialer ).serialize() } );
$( dialer ).reset();
}

URL变量是按批次分类的:php?ext=1234。 储存在PHP中,价值为美元。 结果是,将送还html的四舍五入,而传译器是一种用户将进入电话号码的形式;我需要将这段话与可乘数的两倍加。 php。 我的想法是,把这两人混为一谈。

var ext = "<? $uext ?>";
var par = $( dialer ).serialize();
var url = par;

之后使用卢尔代替<代码>$(dialer )。 但是,这并不奏效;二分。 php的报告从来都没有<代码>ext变量。 怎样才能将URL变量转换成PHP,然后移入 j,然后将其重新引入PHP? 如果我提出错误解释的话,我预先道歉,这对我来说都是新的。

感谢!

问题回答

你有正确的想法,但你需要使用诸如<条码>、<>条/代码>或<条码>等指挥系统来填入变量:

var ext = "<? echo $uext ?>";

否则,作为购买力平价说明,本身并不有效。

Also, you need to include the ext variable into your parameter list. Your current code as it stands doesn t make any further references to ext after it is populated:

var par = $( dialer ).serialize();
par +=  &ext=  + ext;

I can t understand fully what you want, but for similar cases I ve been using: from URL to PHP GET method, from PHP to JS JSON with jsonencode() (ajax), and finally a POST or GET in ajax to a php page.

应采取更好的办法做到这一点。

在再次审视你的例子时,我曾看到你在javascript中使用过营地,但你没有回音,因此应该这样做:

var ext = "<? echo $uext; ?>";

如果像你提到的那样,它只是一个直截了当的参数,那么就没有任何理由可以直接进入贾瓦文。 由于你似乎重新使用jQuery,你可能想对 plugin.





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签