Dataprocessor problem

hello everyone!
i have a problem with the dataprocessor. i searched the forums and google and tried to solve it on my own… without success…
here is the setup:
the html for the calendar:

<script src="codebase/dhtmlxscheduler_debug.js" type="text/javascript" charset="utf-8"></script>
<link rel="stylesheet" href="codebase/dhtmlxscheduler.css" type="text/css" charset="utf-8">
<div id="scheduler_here" class="dhx_cal_container" style="height: 500px;">
	<div class="dhx_cal_navline">
		<div class="dhx_cal_prev_button">&nbsp;</div>
		<div class="dhx_cal_next_button">&nbsp;</div>
		<div class="dhx_cal_today_button"></div>
		<div class="dhx_cal_date"></div>
		<div class="dhx_cal_tab" name="day_tab" style="right:204px;"></div>
		<div class="dhx_cal_tab" name="week_tab" style="right:140px;"></div>
		<div class="dhx_cal_tab" name="month_tab" style="right:76px;"></div>
	</div>
	<div class="dhx_cal_header"></div>
	<div class="dhx_cal_data"></div>
</div>
<script type="text/javascript">
scheduler.config.multi_day = true;
scheduler.config.xml_date = '%Y-%m-%d %H:%i';
scheduler.config.readonly = false;

scheduler.init('scheduler_here');
scheduler.parse('{$xml}');

dp = new dataProcessor('test.php');
dp.init(scheduler);
</script>

loading data works just fine this way… i am using smarty templating engine to fill the {$xml} with xml…
now i want to use the dataprocessor to insert sth into the calender (test.php) and already registered it in the html:

<?php
	$ids = explode(",", $_POST['ids']);
	header("Content-type: text/xml");
	echo "<?xml version=\"1.0\" encoding=\"utf-8\"><data>";
	foreach($ids as $id) {
		switch($_POST[$id."_!nativeeditor_status"]) {
		case "inserted":
			echo "<action type=\"insert\" sid=\"$id\" tid=\"$id\"/>";
			break;
		case "updated":
			echo "<action type=\"update\" sid=\"$id\" tid=\"$id\"/>";
			break;
		case "deleted":
			echo "<action type=\"delete\" sid=\"$id\" tid=\"$id\"/>";
			break;
		}
	}
	echo "</data>";
?>

the script is triggered and after processing data it should return an xml to confirm the insertion. but the returned xml (or anything else - even empty return) is shown in a javascript popup window. the debug console says:

 Server response received details
<?xml version="1.0" encoding="utf-8"><data><action type="insert" sid="1326113123778" tid="1326113123778"/></data>
Not an XML, probably incorrect content type specified ( must be text/xml ), or some text output was started before XML data

maybe it is important to tell you that i use joomla and display the calender in an own component, but the test.php is (as you see) completely independent from joomla and should just return plain xml…
am i missing sth? do i need the connector to use the dataprocessor? or do i miss anything else?

thx in advance,
johannes

do i need the connector to use the dataprocessor? or do i miss anything else?
You need not connector while you are working with custom server side code, and dataprocessor is already part of dhtmlxscheduler.js

The response has valid XML structure, so the problem can be because of

a) content type - try to use firebug or dev-tools in chrome and check the response type of that operation in network panel. It possible that some .htaccess based rule override content type

b) try to load the test.php directly in browser (FF) and check what it shows - if there indeed some trailing white spaces, FF will complain about not-well formed XML

thx for your answer…
i think you are right… the header of the response containing the xml is still “text/html” although the header() function is called to change the content type… damn :stuck_out_tongue: maybe that is the problem. but what is responsible for the html output inside a javascript popup? is it dhtmlx just pushing everything with a non xml content type into a js popup? if this is the case i know where to start debugging :wink:
thx again :slight_smile:

ok… now the header has the right content type… i changed the line

header("Content-type: text/xml");

to

header('Content-type: text/xml');

but the javascript still pops up… although the console shows no errors… well that js popup drives me round the bend… :stuck_out_tongue:

hm… wrong observation… the content type is right, but the error in the console stays the same… im running out of ideas…

thx @Stanislav for your help :slight_smile: got it!

id love to provide a solution for others who may face a similar problem, but i just completely redesigned my code and now it works…