send $_POST data via anchor tag

后端 未结 4 468
长发绾君心
长发绾君心 2021-01-07 16:02

is it possible to somehow send $_POST[] data via a tag? because it seems to automaticly execute the $_POST[] once the page l

4条回答
  •  灰色年华
    2021-01-07 16:14

    You can achieve this using jQuery and a HTML form

    HTML:

    Button: (html)

    sometexthere
    

    Javascript, or rather said jQuery:

    $(".button").click(function() {
        var link = $(this).attr('var');
        $('.post').attr("value",link);
        $('.redirect').submit();
    });
    

    this jQuery code listen's to any clicks on the items with the class button attached to them, and reads out their "var" value, basicly you could use any kind of HTML element using this method as long as they have the button class attached to it.

提交回复
热议问题