Reputation:
I have a simple form, when users submit the form, after successful validation, they get an alert
if (valid) {
alert("Your Request Has Been Submitted")
}
return valid;`
My goal is to have an auto incremental ticket number displayed in the javascript alert, I realize this can only happen after the data has been posted to the db, and that this can easily be done by sending the user to another page, but I'd like to have the page refreshed, and have an alert popup giving them a ticket number, then they can close the alert box and make another submission. Any assistance is appreciated. THANKS!!!
Upvotes: 1
Views: 497
Reputation: 16039
You can do something like:
<script>
var valid = <?php echo $query_result; ?>;
if (valid) { alert("Your Request Has Been Submitted") }return valid;
</script>
Ensure that you PHP code echo'es a valid javascript for the value of the valid
variable
Upvotes: 0