weixin_33737774 2014-07-13 15:43 采纳率: 0%
浏览 15

PHP和Javascript事件处理

I know that php is a server-side language. However I am confused on how to hook up a html button event to a page that uses php. I understand this will probably involve Javascript, some css and html and maybe Ajax. I've been looking at some examples but they don't explain the important pieces I am looking for. In summary I want to see the code for the click event and how php gets notified there was a click.

I apologize if this is a strange question. I'm used to old application programming and I'm trying to understand some of these newer practices.

  • 写回答

2条回答 默认 最新

  • weixin_33671935 2014-07-13 15:47
    关注

    The actual click event will never be sent to PHP. The outcome of the click is what the server (PHP) will see.

    For example, if your button redirects the user to a different page, your PHP will be "notified" as soon as the GET request reaches your sever.

    For a form element, the submit button will issue a POST request to a certain URL, that request is what you can "interpret" as the click event. The same goes for an AJAX request.

    评论

报告相同问题?