Using jQuery to look up City and State from Zip Code entry


We have been working on a multi-step form that collects user’s zip code in step-1, and returns city and state in step-4. And finally got it working!

But, then, as I was trying to finagle some other usability, the functionality has stopped working.

Form elements and javascript code snippets:

			    <label>Zip Code:</label>
				<input type="text" id="searchzipcode" name="SearchZipCode" value="Zip Code" class="required" title="Please enter your Zip Code here." />
			    <label class="small_left_c">City:</label>
				<input type="text" id="city" name="city" value="City" class="required" title="Please enter your City here." />
			    <label class="small_right_s">State:</label>
				<input type="text" id="state" name="state" value="State" class="required" title="Please enter your State here." />

<script type="text/javascript">
jQuery(document).ready(function($) {
	var current_step = 1;
	$('form#home_form').submit(function(e) {
		var isValidZip = /(^\\d{5}$)|(^\\d{5}-\\d{4}$)/.test(jQuery('#searchzipcode').val());
		if(current_step == 1){
				alert('Please enter a valid Zip Code.');
				$('#home_form fieldset').hide();
				jQuery.getJSON('/zip-lookup.php?zip='+jQuery('#searchzipcode').val(), function(data) {

I had changed the id of both city and state to id=“v_city” & id=“v_state” (in the form only) when I noticed the error. So I reverted it immediately.

However, the error remains.

I have been reading line by line for hours now, and can’t find any difference from the file and the backup I made prior to making changes.

I even copied the backup files back into the folder, but get the error still!

Any ideas??

(I can provide the entire code, or link to it, if needed.)

Thanks, in advance!

well, after a hard reset, things are back to normal. (maybe a cache issue, or session variables.)

While the problem is fixed, I would still appreciate any insight as to the “Why” for this problem.