简体   繁体   中英

how to call php function using javascript onclick event?

image onclick using javascript and javacript function is used to call the php function. How to call php function using javascript on click event and the php is on the same page.

<input type="image" src="test.png" height="45" width="45" onclick="clickCall()" align="right"/>

<script type="text/javascript">
function clickCall(){
    var phpcall=<?php saveCallClickUsage(); ?>    
}
</script>

<?php 
function saveCallClickUsage(){
    echo "<script>alert('test');</script>";
}
?>

Use Ajax for do that. Hope it helpful.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM