send $_POST data via anchor tag

后端 未结 4 1359
夕颜
夕颜 2021-01-07 16:00

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:32

    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.

提交回复
热议问题