Author Topic: Zend returning meta tag during xhrPost  (Read 1084 times)

0 Members and 1 Guest are viewing this topic.

Offline bugducTopic starter

  • Irregular
  • Posts: 1
    • View Profile
Zend returning meta tag during xhrPost
« on: April 02, 2009, 07:42:39 PM »
I have a Zend 1.7.6 app using Dojo 1.3. I am using dojo.xhrPost to send a form to a controller in Zend. The front controller is setup with "noViewRendered". When the xhrPost call happens, everything works as planned except for the response. The response received is "<meta http-equiv="content-type" content="text/html;charset=utf-8">91", where 91 is the ID I am sending back. I expect to receive only the 91 in the response but I am getting the meta tag as well. Does anyone know where this is getting set/picked up? Code for controller and javascript is as follows:

function saveFamily(divToUpdate)
{
    if(dijit.byId('formFamily').validate())
    {
        dojo.xhrPost({
          url: "/family/add",
          load: function(response, ioArgs){
              alert(response);
              if(Number(familyID) > 0)
              {
                  dojo.publish("guardianTopic", [{
                  message: "Family information saved!",
                  type: "message",
                  duration: 2000
                  }]);
                  document.getElementById('familyId').value = familyID;
                  dojo.byId('formFamily').disabled = true;
                  dijit.byId('guardianFirstName').focus();
              } 
              else
                alert('Ouch!');
             
              return response;             
          },
          error: function(response, ioArgs){
            dojo.byId(divToUpdate).innerHTML = "An error occurred, with response: " + response;
            return response;
          },
          form: "formFamily",
          handleAs: "text"
      });
      //dojo.byId('address1').disabled = !dojo.byId('address1').disabled;
      //document.getElementById('familyId').value = '1';
    } 
   
}


 public function addAction()
    {
        try
        {
            $req = $this->_request;
            $posts = $req->getPost(); 
            $family = new Model_DbTable_Family();
            $data = array('family_name' => $posts['familyLastName'],
                'last_visit' => date('Y-n-j'),
                'email' => $posts['email'],
                'home_phone' => $posts['homePhone'],
                'work_phone' => $posts['workPhone'],
                'cell_phone' => $posts['cellPhone']
            );
            $familyId = $family->insert($data);
            echo $familyId;
           
        }
        catch(Exception $e)
        {
            echo '0';
        }
    }

Offline Daniel0

  • Administrator
  • 'Insane!'
  • *
  • Posts: 11,815
  • Gender: Male
  • ^bb|[^b]{2}$
    • View Profile
Re: Zend returning meta tag during xhrPost
« Reply #1 on: April 04, 2009, 03:27:25 AM »
It's none of that. It could come from anywhere inside your application. Check the layout file.