Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Cryptography And Network Security

Authors: William Stallings

5th Edition

9780136097044

Students also viewed these Programming questions