PDA

View Full Version : [3.0.1] PHP doesn't response with a JsonStore



attu
3 Mar 2010, 6:28 AM
Hello!!

I've got this JsonStore:


var storeCalendario = new Ext.data.JsonStore({
url: '../include/tablaAnualValidarEmpleados.php',
root: 'dias',
fields: ['columna','fecha','color'],
autoLoad: false,
totalProperty: "results",
listeners:{
load: function(obj, registro, opciones) {
//some stuff
},
scope: this
}

});


And i load it like this:


storeCalendario.load({
params: {
Fecha: '2006-01-01'
}
});


I don't know why, but when i load the store, it doesn't response. I tried writing an echo at the beginning of the file tablaAnualValidarEmpleados.php, but it doesn't response.

the problem is sometimes works and returns a valid json and sometimes not...

Does anybody know any issue?

I've attached a capture of my firebug when i call load function from console.

Thanks :).

httpdotcom
3 Mar 2010, 7:35 AM
Did you expand the load failure to see if it was displaying an error from the PHP script?
Did you check the server's (your computer) php error log to see if the script is throwing a fatal error?

attu
3 Mar 2010, 11:20 PM
Hi!

Thanks for your response :).

The response of firebug displays nothing and PHP's error.log displays:
[Thu Mar 04 08:10:19 2010] [error] [client 127.0.0.1] File does not exist: C:/AppServ/www/favicon.ico
[Thu Mar 04 08:10:22 2010] [error] [client 127.0.0.1] File does not exist: C:/AppServ/www/favicon.ico

That's very extrange...

cog
4 Mar 2010, 4:03 AM
You should check your settings in php. I had the same problem with data not being loaded, due to php error reporting. I changed it from E_ALL .. to :

ini_set('error_reporting', E_PARSE | E_ERROR );
ini_set("display_errors", false);
which solved the issue for me. I use Fiddler to check on those things. (Just keep in mind when using fiddler that it sets a proxy in IE, which you need to turn of after you've finished, else you will have a problem connecting to some sites). You can see your post/get by selecting inspectors and TextView or WebForms and the result in the lower block in TextView.

Hope this helps.

Regards

Carl

attu
4 Mar 2010, 4:20 AM
Thanks cog!

Where should i write that code? in PHP.ini, in my php controller or at the biginning of my webapp (i mean index.php)??

Thank you very much!!

steffenk
4 Mar 2010, 4:35 AM
write at beginning of your php:

error_reporting(E_ALL);

Test your php script before use, test all possible params, also without params. it must be stable.

cog
4 Mar 2010, 4:53 AM
Put it before your php code starts so the page you request after <? or <?php
and then the remaining code can execute
This has the advantage that you do not need to change your php.ini!
I usually include a file with those settings like:



<?
require ( 'path/to/your/include/file/with/the/ini/settings.php');

[code to execute];

?>


So I can set it in a singel file and use it on every page where required.

steffenk
4 Mar 2010, 5:06 AM
@cog - ini_set isn't good and should be not used. With error_reporting you have a runtime config option.

attu
4 Mar 2010, 6:21 AM
The only one error in error.log is:


[Thu Mar 04 15:17:55 2010] [error] [client 127.0.0.1] File does not exist: C:/AppServ/www/favicon.ico


I don't know what's happening... Maybe my appserv is not working correctly...

httpdotcom
5 Mar 2010, 1:47 PM
The error.log you are looking at isn't the PHP error log (it is your web server log), which is stating it couldn't find favicon.ico in your web directory (PHP has nothing to do with delivery favicon files).

Check phpinfo() to see what your error log is set to (should be set to file and a path to that file).

ps. switch POST to GET in your store script and call your store code directly, and see if it is delivering results.

attu
8 Mar 2010, 12:55 AM
Hi httpdotcom,

Thanks for your response. PHP is sending back the json but, sometimes, client side doesn't work... it's very extrange...