Question
So I have this code that will change state initials to the full state name. Right now I only have a single state(Illinois) how would
So I have this code that will change state initials to the full state name. Right now I only have a single state(Illinois) how would I be able to switch it to any state abbreviation that the user puts in turns into the full state name, not just Illinois.
stateabbrev.html
State Abbreviations State Abbreviation: function successFunction(data,status) { $("#output").text("State: " + data); } $(document).ready(function() { $("#myForm").on("submit", function() { var myState = $("#state").val(); var myData = "state=" + myState; $.ajax({ type: "POST", url: "statefull.php", dataType: "json", success: successFunction, data: myData }); return false; }); });
statefull.php
$stateAbbrev = trim($_POST['state']); if ($stateAbbrev == "IL") { print json_encode("Illinois"); } ?>
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started