/ Published in: PHP
URL: http://www.dropthenerd.com/ajax-a-simple-approach-that-you-will-use-and-reuse/
Expand |
Embed | Plain Text
<?php $answer = $_POST['answer']; if($answer == '8'){ echo json_encode( 'success' => 1, 'message' => 'Correct! 3 + 5 = 8' ) ); }else{ echo json_encode( 'success' => 0, 'message' => 'Sorry, that is the wrong answer.' ) ); } // just to have an extra failsafe! echo json_encode( 'message' => 'You must choose a valid response.' ) );
You need to login to post a comment.
