How to call a php script/function on a html button click

后端 未结 7 2042
南旧
南旧 2020-11-27 19:20

Before someone has a go at me or marks this down, I have looked all over the internet to find out how to do this (including the same question on stackoverflow). I\'m new, an

7条回答
  •  死守一世寂寞
    2020-11-27 19:51

    the_function() {
    
    $.ajax({url:"demo_test.php",success:function(result){
    
       alert(result); // will alert 1
    
     }});
    
    }
    

    // demo_test.php

    
    

    Notes

    1. Include jquery library for using the jquery Ajax
    2. Keep the demo_test.php file in the same folder where your javascript file resides

提交回复
热议问题