English 中文(简体)
如何在点击环节时从联合材料中指定一个PHP功能?
原标题:How to call a PHP function from JS that is invoked when clicking a link?

我有这个试验页:

http://www.comehike.com/hikes/uncancel_hike.php?hike_id=30

在点击“yes”时,我能够援引“ Java”字典功能,称为“uncancel”。 Hike,但我不知道如何称呼PHP的功能。

我的确进口了一个称为“无动于衷”的“加拿大文”,但我并不肯定如何从该 Java稿中提。

我确实在守则中使用“青年倡议”,但我不敢肯定我是否应该在这里使用,或者这更简单。

最佳回答

你们需要在这里使用美国宇宙航空研究开发机构,这一理论应当有助于:

Beginning AJAX Using The YUI Library

问题回答

Ajax不是所有东西的答案:D

<?php

    if(isset($_POST[ but1 ])){
        t1();
    }elseif(isset($_POST[ but2 ])){
        t2();
    }


    function t1()
    {
       echo "The t1 function is called.";
    }
    function t2()
    {
       echo "The t2 function is called.";
    }

?>

<html>
<head>
<title>Test</title>
</head>
<body>
<form action="test.php" method="POST">
<input type="submit" value="Click1" name="but1">
<input type="submit" value="Click2" name="but2">
</form>
</body>
</html>




相关问题
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.

热门标签