onclick -> mysql query -> javascript; same page

后端 未结 4 1263
自闭症患者
自闭症患者 2021-01-29 03:41

I need button to begin a mysql query to then insert the results into a javacript code block which is to be displayed on the same page that the button is on. mysql queries come f

4条回答
  •  不思量自难忘°
    2021-01-29 04:39

    Use AJAX,

    example

    $.ajax({
        type: "POST",
        url: "yourpage.php",
        data: "{}",
        success: function(result) {
            if(result == "true") {
                // do stuff you need like populate your div
                $("#one").html(result);               
            } else {
                alert("error");
            }
        }
    });
    

提交回复
热议问题