Problemo:
My PHP Script (it's just a snippet) is not picking up my JavaScript code. It doesn't even see the zip code field. It says it doesn't exist:
<?php
$zipCode = $_GET[zipCode];
//echo "data:".$zipCode;
$json = "{data:.$zipCode}";
echo $json;
//echo json_encode(array("data"=>$zipCode));
//print ("Zip Code:".$zipCode);
?>
I'm passing it in the following code block:
function getCityAndState(data, location)
{
var jsonString = {"zipCode": data};
alert("JSON String:" + jsonString.zipCode);
if (location === "living")
{
$("#livingCityField").val("");
$("#livingStateField").val("");
alert("Inside getCityAndState: " + location);
$.ajax({
type: "GET",
url: "getCityAndState.php",
async: true,
dataType: "json",
data: {zipCode: data},
success: function(data){
alert("SUCCESS:" + data.zipCode);
},
complete: function(data)
{
alert("No bueno");
}
});
At this point I'm just trying to pass it a zip code and retrieve that zip code both in JSON format. Help! I've been working on this for six hours!
By the way this doesn't use a form but fires on event handling. It fires when there are five characters typed into a JQuery modal window with form objects embedded through a <div></div>.
Ferrari