I want to call a php function inside a JS function, my php function uses an input as param and push the returned value in the : index.html :
<input type="text" name="my_value">
<button type="button" name="confirm" onclick="validate()">Submit</button>
my_script.JS:
function validate() {
var errors = [];
//here I want to call check function using the input my_value
}
test.php :
function check($my_value){
//some long test on $my_value{
return "valid";
}else{
return "not valid";
}
}
How can I call it in my validate JS function?