Hi,
I just tested ajax for dhtmlx suite 5.1 standard edition with server response status code 500. I found the problem that the ajax does not have response text (r.xmlDoc.responseText no value). But, when i use dhtmlx suite version 4, it’s okay, i have the response text. You can see the screenshot attached.
Note1: This is ajax cors
This is the client code:
[code]
DHTMLX 5.1 Ajax
function TestStatusCode(){
var _callback = function(r){
var rJSON = dhx.s2j(r.xmlDoc.responseText);
dhtmlx.log(‘DATA’, rJSON);
};
dhx.ajax.get(‘http://localhost:28080/_dhx51/TestStatusCode.php’, _callback);
}
</script>
</head>
<body onload="TestStatusCode()">
</body>
[/code]
This is the server code:
[code]<?php
header(‘Access-Control-Allow-Origin: *’);
header(‘Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept’);
header(‘Content-type: text/json’);
$response_code = 500;
http_response_code($response_code);
$response[‘status’] = true;
$response[‘messageType’] = ‘INFO’;
$response[‘message’] = 'DHTMLX Ajax tested with response status code ’ . $response_code;
echo json_encode($response);
?>[/code]
I still need the response text for status code 500, since Codeigniter Error used this status code and i need the error message. Wish somebody can help me.
#edit1: added screenshot ajax error
#edit2: added Note1
Thanks,
masdju