Home  >  Article  >  Backend Development  >  javascript - 在一个页面有很多个button,怎么用 js控制button响应后端的php不同的action

javascript - 在一个页面有很多个button,怎么用 js控制button响应后端的php不同的action

WBOY
WBOYOriginal
2016-06-06 20:48:041039browse

在一个页面有很多个button,怎么用 js控制button响应后端的php不同的action

回复内容:

在一个页面有很多个button,怎么用 js控制button响应后端的php不同的action

前端页面:





后端页面:


趁早结了这个没意义的问题吧,一个问题翻来覆去的问好几遍..有意思么!




然后 jQuery 这样处理

$('.action').on('click', function() {
    var action = $(this).data('action');
    $.get(action, function(data) {
        // do something with data.
    });
});
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn