Get Data From Php, Validate In Javascript Function And Echo Automatically On Choosing The Value Of Dropdown
I want to GET data from php, validate in javascript function and echo automatically on choosing the value of DropDown, without any Submit, i.e. just choose the value and the result
Solution 1:
Solution 2:
look at this simple exemple to know how to use ajax requests :
PHP :
lets say this file is validation.php :
<?php$var = $_GET['variable1'];
//do you work here die("good");//or die('bad'); according to your validation?>
JS :
$.get(
'validation.php',//path to your php validation file
{
variable1 : 'value'//the name of the get variable sent
},
function(data){//call back function//data here contains what the validation.php file returnedif(data=="good"){
//do good stuff
}elseif(data=="bad"){
//do bad stuff
}
);
}
Post a Comment for "Get Data From Php, Validate In Javascript Function And Echo Automatically On Choosing The Value Of Dropdown"