title: Need to return to Full Calendar after JSON-events called from POST method
body: <p>I am using JQuery Full Calendar to display the results of a JSON feed from my mysql localhost. Initially it updates from the Calendar function using <code>events: "json-events.php",</code>, but I am also trying to run <code>json-events.php</code> from a submit button on a form using POST method and a submit button. While the JSON feed works great, I only get an ECHO of the results, and cannot get back to index.php to display the results on the calendar.
  Code for json-events.php...</p>
  
  <pre><code>&lt;?php
  
  $year = date('Y');
  $month = date('m');
  $day = date('d');
  
  $link = mysql_connect('localhost','root','');
  if (!$link) { die('Could not connect: ' . mysql_error()); }
  mysql_select_db('jauntUK');
  
  $latevent = $row['Lat'];
  $lngevent = $row['Long'];
  $tgtlat = $_POST['searchlat'];
  $tgtlatstring = number_format($tgtlat, 16, '.', '');
  $tgtlng = $_POST['searchlong'];
  $tgtlngstring = number_format($tgtlng, 16, '.', '');
  
  
  if($_POST) {
  
  
      $result = mysql_query("SELECT *, ( 3959 * acos( cos( radians( `Lat` ) ) * cos( radians(" . $tgtlatstring . ") ) * cos( radians(" . $tgtlngstring . ") - radians( `Long` ) ) + sin( radians( `Lat` ) ) * sin( radians(" . $tgtlatstring . ") ) ) ) AS distance FROM EventData HAVING distance &lt; 5")
  or die (mysql_error());
  
  // Initializes a container array for all of the calendar events
  $jsonArray = array();
  
  while($row = mysql_fetch_array($result, MYSQL_ASSOC))
  {
      var_dump($row);
  
   $eventtitle = $row['Title'];
   $eventdate = $row['StartDate'];
   $eventend = $row['EndDate'];
   $eventallday = $row['FullDay'];
   $eventURL = $row['URL'];
   $Description = $row['Description'];
   $Address1 = $row['Address1'];
   $Address2 = $row['Address2'];
   $Address3 = $row['Address3'];
   $Address4 = $row['Address4'];
   $PostCode = $row['PostCode'];
   $Admission = $row['Admission'];
  
   // Stores each database record to an array
   $buildjson = array('title' =&gt; "$eventtitle", 'start' =&gt; "$eventdate", 'end' =&gt; "$eventend", 'allday' =&gt; "$eventallday", 'eventURL' =&gt; "$URL", 'description' =&gt; "$Description", 'Address1' =&gt; "$Address1", 'Address2' =&gt; "$Address2", 'Address3' =&gt; "$Address3", 'Address4' =&gt; "$Address4", 'PostCode' =&gt; "$PostCode", 'Admission' =&gt; "$Admission");
  
   // Adds each array into the container array
   array_push($jsonArray, $buildjson);
  }
  // Output the json formatted data so that the jQuery call can read it
  echo json_encode($jsonArray);   
  header('location: index.php');
  
  
   } else { 
  
  
   echo json_encode(array(
  
          array(
              'id' =&gt; 001,
              'title' =&gt; "Search for events near you",
              'start' =&gt; "$year-$month-$day",
  
          )
  
      ));
  }
  ?&gt;
  </code></pre>
  
  <p>Any advice? - thanks in advance for your help</p>