我在firebug控制台中得到了index.php.html


I get index.php html in firebug console

我有一个ext-js面板组件,当提交时,它会在firebug控制台中抛出js错误。我说

 'You're trying to decode an invalid JSON String: <html>
         ... index.php html code here
  </html><!-- use login javascript file --> <!--<script type="text/javascript"    src="http://localhost:9808/recorder/js/login.js"></script>--> 
   <script type="text/javascript">      
        login = true; 
   </script> 
   <div id="login_window"> </div>' when calling method: 
        [nsIDOMEventListener::handleEvent]

交互作用是html代码与"html"标记后的一些附加html连接在一起。我得到的是index.php.html代码,而不是json。至于我调用的check()函数,我只调用ecoes的json数据。

我的组件代码是这样的

     login_group_combo = Ext.create('Ext.form.ComboBox',
   {
    name: 'combo_name',
    id: 'combo_id',
    fieldLabel: text_label,
    editable: false,
    //possible view options
    store: [
    ],
    listeners:
    {
        focus: function(elem, e)
        {
                function1();
        }
    }
});

函数1()看起来像这个

   function function1(){
      form1.submit({
         url: './index.php/mypage/check',
         success: function(f,a){
             // some code here
             echo json_encode($result_array);
         },
         failure: function(form, action){
            switch (action.failureType) {
               case Ext.form.action.Action.CLIENT_INVALID:
                   Ext.Msg.alert('Failure', 'Invalid data entered!');
                    break;
               case Ext.form.action.Action.CONNECT_FAILURE:
                   Ext.Msg.alert('Failure', 'Ajax communication failed');
                   break;
               case Ext.form.action.Action.SERVER_INVALID:
                  Ext.Msg.alert('Failure', action.result.msg);
             }
          }
      });
   }

有趣的是,执行进入函数1();但没有进入表格1,成功或两者都没有。可能是什么问题?

如果加载/index.php/mypage/在浏览器中查看源代码,你看到json还是html?通常,服务器框架中的某些内容是通过页眉和页脚布局代码或类似代码放入html中,并且需要设置一些配置,以便返回原始json字符串。