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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!