$.getJSON not working with simple PHP Script

7331

New Member
The JS doesn't work with the PHP script. I get no response. Here's the PHP script:\[code\]<?php$a = array('data' => 'Hello');echo json_encode($a);?>\[/code\]Here is the JQuery Script: \[code\]function getCityAndState(data, location){ var jsonString = {"zipCode": data}; var outR = outputResults alert("JSON String:" + jsonString.zipCode); if (location === "living") { $("#livingCityField").val(""); $("#livingStateField").val(""); alert("Inside getCityAndState: " + location); //$.get("testfile.php", // {zipCode: data}, // outR, // 'text' // ); $.getJSON("testfile.php",function(d) { alert("JSON Data: " + d.data); });}\[/code\]What am I doing wrong?\[code\]alert("Inside getCityAndState: " + location);\[/code\] does execute as expected but otherwise nothing happens. There is no exception thrown, no error message, nothing. It doesn't return any data at all.I'm using Aptana 2 as an IDE, in case that makes a difference.
 
Top