Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- valid_user() {
- $id = $_POST('id');
- if($id == 'hello'){
- return true;
- }
- else{
- return false;
- }
- }
- $.ajax({
- type: "POST",
- url: path + "valid_user",
- sucess: function(msg) {
- alert("Data returned: " + msg );
- }
- });
- $.ajax({
- type: "POST",
- url: "validateUser.php",
- data: "id=49",
- success: function(msg){
- alert( "true or false: " + msg );
- }
- });
- success:function(data, textStatus)
- <?php echo valid_user(); ?>
- $id = isset($_POST['id']) ? trim($_POST['id']) : '';
- $return = 'false';
- if($id!=''){
- valid_user($id);
- }
- echo $return;
- valid_user($id) {
- if($id == 'hello'){
- $return = 'true';
- }
- }
- <script>
- id = 'hello';
- $.ajax({
- type: "POST",
- url: "validateUser.php?id="+id,
- success: function(msg) {
- alert("Data returned: " + msg );
- }
- });
- </script>
Add Comment
Please, Sign In to add comment