tags:

views:

102

answers:

1

Hi, I tried to retrieve the value of a particular variable and alert it. That is,I wanted to get the value "{"attributes":[{"type":"Text","labels":"Untitled1"}]} " in that variable. Using the success: function(msg) in ajax ,I alerted the value.

But instead of the required value :{"attributes":[{"type":"Text","labels":"Untitled1"}]} I am getting the text given below. What is the problem?

1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
 <html xmlns="http://www.w3.org/1999/xhtml"&gt;
  <head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   <title>
         CakePHP: the rapid development php framework:  Forms 
      </title>
  <link href="/cake_1_2/favicon.ico" type="image/x-icon" rel="icon" />
  <link href="/cake_1_2/favicon.ico" type="image/x-icon" rel="shortcut icon" />
  <link rel="stylesheet" type="text/css" href="/cake_1_2/css/cake.generic.css" />
  </head>

  <body>
        <div id="container">

     <div id="header">
     <h1>
           <a href="http://cakephp.org"&gt;CakePHP: The rapid development php framework</a>
           </h1>
     </div>

       <div id="content">   

                   {"attributes":[{"type":"Text","labels":"Untitled1"}]}

    </div>

    <div id="footer">
    <a href="http://www.cakephp.org/" target="_blank">
          <img src="/cake_1_2/img/cake.power.gif" alt="CakePHP: The rapid development php framework" border="0" />
          </a>  
    </div>
     </div>
</body>

+2  A: 

The problem is that you still use the default layout. Try switching to another shipped layout for Ajax-responses:

// In your controller
$this->layout = 'ajax';
PatrikAkerstrand
Thank you. It worked..
Angeline Aarthi