lundi 16 juin 2014

Uncaught TypeError: Cannot read property 'timeout' of undefined

Hi@all,

i am trying to receive data for my cordova app for Android out of a MySQL database via a php script from a Synology DS213j NAS. The database and the table (int id, String name, int value) was created with the help of phpMyAdmin. Sencha Touch 2.3.x, Sencha Architect 3.0.4.1386 and cmd version 4.0.4.84 were used.


This is the code of the store, proxy and the reader:



Code:



Ext.define('BDE.store.MyJsonPStore', { extend: 'Ext.data.Store',


requires: [
'BDE.model.test',
'Ext.data.proxy.JsonP',
'Ext.data.reader.Json'
],


config: {
model: 'BDE.model.test',
storeId: 'MyJsonPStore',
proxy: {
type: 'jsonp',
api: {
create: 'http://ift.tt/U1oPgg',
read: 'http://ift.tt/SMNNig',
update: 'http://ift.tt/U1oPgl',
destroy: 'http://ift.tt/U1oQky'
},
url: 'http://ift.tt/SMNNii',
reader: {
type: 'json',
rootProperty: 'values'
}
}
}
});

And this is the php code located on the webserver of the NAS:

Code:



<?php

if($_GET['action'] == 'actiontest') {
echo 'actiontest';
}
elseif($_GET['action'] == 'create'){
echo 'createtest';
}
elseif($_GET['action'] == 'read'){
$link = mysql_connect('192.0.0.50', 'root', '');

if(!$link) {
die('Unable to connect to MySQL Database: ' . mysql_error());
echo 'Fail!';
}
else{
}

$db_found = mysql_select_db('kammann_bde');

if(!$db_found) {
die('Unable to connect to MySQL Database Table: ' . mysql_error());
echo 'Fail!';
}
else{
}

$SQL_read = 'SELECT * FROM Test';
$db_result = mysql_query($SQL_read);

if(!$db_result) {
die('Unable to read from MySQL Database Table Test: ' . mysql_error());
echo 'Fail!';
}
else{
}

$callback = $_REQUEST['callback'];
//if($rows == 3){echo $callback . '('. json_encode($result) .')';}
if ($callback) {
header('Content-Type: text/javascript');
echo $callback . '('. json_encode($db_result) .');';
} else {
header('Content-Type: application/x-json');
echo json_encode($db_result);
}
}
elseif($_GET['action'] == 'update'){
echo 'updatetest';
}
elseif($_GET['action'] == 'destroy'){
echo 'destroytest';
}
else{
echo 'notest';
}

?>

The database and the specific table are found by the php script. Due to the fact that the error appears in the app.js file I think it could be a Sencha related problem. I am receiving the following error in Eclipse LogCat:

file:///android_asset/www/app.js: Line 1 : Uncaught TypeError: Cannot read property 'timeout' of undefined


I did not find anything on the web about it. I am thinking that the error has something to do with the callback of the json calls. Is there a timeout during the connection or anything similar? Changing the timeout value of the proxy did not help! Or has it something to do with types, casting or giving back results in the wrong type?!


Any help would be appreciated.


Greetings,

k_tbe





Aucun commentaire:

Enregistrer un commentaire