title: jquery ajax function returning null rather than json
body: <p>I am developing a contact form that is submitted via the ajax command, the data is sent to a php file where it is processed and a json object is returned but i am having some trouble getting the json object back to into the ajax command as it keeps returning null, the code i am using is as follows...</p>
  
  <pre><code>$("#send").click(function () {
      var complete = true;
      $('input#name, input#email, input#subject, textarea#message').each(function () {
          if ($(this).val()) {
              $(this).css("background", "#ffffff").css("color", "#111111");
          } else {
              $(this).css("background", "#d02624").css("color", "#ffffff");
              complete = false;
          }
      });
      if (complete == true) {
          var name = $("input#name").val();
          var email = $("input#email").val();
          var subject = $("input#subject").val();
          var message = $("textarea#message").val();
          var data = '{"name":"' + name + '","sender":"' + email + '","subject":"' + subject + '","message":"' + message + '"}';
          $.ajax({
              type: "POST",
              url: "contact.php",
              data: "token=" + $.base64.encode(data),
              dataType: "json",
              success:function(response) {
          if (response) {
              var data = $.parseJSON(response);
              alert(data.response);
                  if (data &amp;&amp; data.status == "success") {
                  $.fancybox.close();
              }
          }}
          });
      }
  });
  </code></pre>
  
  <p>You can also see the problem live at: <a href="http://idify.co.uk" rel="nofollow">http://idify.co.uk</a>, thanks for the help, i am not too good with javascript, im still learning...</p>