I can't comment for now :( and write my suggestions as an answer. It seems like you have mistype in protocoleGenerator.php
. May be end line looks like echo json_encode($aray);
, in this case json_encode()
returns pure null
(if you have disable php notices). The success function receives null
and can't get a property from this object. It's only my subjective suggestion. It may be wrong.
P.S: You can get value / call function as Object.my_fun(), or Object['my_func']() - for this particular case it doesn't matter how did you access to the variable. For example:
var o = {};
o.test = 'my test value';
o.fff = function() {return 'fff called.';};
console.log('dot-style:' + o.test);
console.log('arr-style:' + o['test']);
console.log('dot-style:' + o.fff());
console.log('arr-style:' + o['fff']());
Ok, I've got a minus. If assumed, that topic starter show us hard copy-paste of his code, here is no issues. My suggestion based on the error message - the "success function" gets HTTP/200 answer from the server with text "null". With empty or non-valid json response jquery-ajax calls an "error handler". I'm sure that it can't be caused by json_encode()
behaviour - my example above prove it.
Another suggestion is specific server config, rewrites, redirects or something else. But I've exclude this suggestion.
Oh...
<?php
$array = array(1,2);
$аrray = array(3,4);
var_dump($array);
var_dump($аrray);
result looks like that:
array(2) {
[0] =>
int(1)
[1] =>
int(2)
}
array(2) {
[0] =>
int(3)
[1] =>
int(4)
}
Did you see the difference? I don't, but the second $array
begins from cyrillic character.