Jump to content

Zend returning meta tag during xhrPost


bugduc

Recommended Posts

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';

        }

    }

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.