1
我有ext js面板組件,當它被引用時它會在螢幕控制檯中拋出js錯誤。 我說我在firebug控制檯得到index.php html
'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」標籤後,一些additinal HTML級聯。並且我得到了index.php html代碼而不是json。至於我knwo check()函數,我只稱eco只有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();但沒有輸入form1,成功或者沒有faulire塊。可能是什麼問題呢?
您的代碼中缺少一些右括號 – Timmetje 2012-07-13 13:05:43
我試圖找不到括號,您的意思是form_check_user()中的那個。不,這不是問題。我再次檢查了我的代碼,我使用Aptana。它會告訴我如果我丟失括號。 – Vlad 2012-07-13 13:11:37
爲什麼它會轉儲整個index.php html代碼而不是json。 – Vlad 2012-07-13 13:12:24