autoload breaking ajax json response |
I experiment an odd things on codeigniter. Adding my own library, model, or config in the autoload breake my json response in ajax request.
The installation of CI is totally fresh. No url rewriting, nothing change inside the config.php when i load like this my own component : PHP Code: <?php user_helper.php google.php and User_model.php contain strictly nothing user_helper: PHP Code: <?php defined('BASEPATH') OR exit('No direct script access allowed'); User_model: PHP Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); google: PHP Code: <?php defined('BASEPATH') OR exit('No direct script access allowed'); like this we can't say it's my coding who put the mess. and the ajax call looke like this : Code: $(document).ready(function() { the result looke like this ![]() As you can see nothing appear with the console log and no response in json format. If i replace the autoload with this : PHP Code: <?php and i load those missing file inside the controler like this : PHP Code: <?php Tadam it's magic : ![]() the ajax and json respond normally. I must add than when i autoload only one of my own file it's worke normally. It is normal? CI can't autoload more than one of my file without breaking json response? Like you can see i have done nothing inside the project for not polluate the error process.
BOM is a nasty smell.
Check your editor setting and tell it not to use the BOM. It puts hidden characters in your files. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
thanks guys you save my life, you deserve a big kiss....or a beer
![]() Didn't know why 2 of my files were with BOM (normally my text editor is parameterize for not including this stupid thinks) But really a big thanks to both of you!
(03-30-2017, 12:07 AM)lanoux Wrote: thanks guys you save my life, you deserve a big kiss....or a beer How did you find the file with BOM encoding?
11-26-2017, 04:57 AM
(This post was last modified: 11-26-2017, 04:59 AM by InsiteFX. Edit Reason: Spelling error )
If you look at the files there will be weird characters at the beginning of the file, like hex code.
At the beginning of the HTML page. BOM: FEFE 2D30 2D63 2D53 2D4D 0021 ("Big edian") FFFE 302D 632D 532D 4D2D 2100 ("Little edian") What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
|
Welcome Guest, Not a member yet? Register Sign In |