marijnh/CodeMirror2 — Issue #386: CodeMirror Very Slow to load 
Author: almogdesign
Created: 2012-02-23 23:48:56+00:00
State: open

Testing out CodeMirror, however I'm finding it to be very slow to load. I have a JavaScript Lightbox that makes a call and then loads another html page that has the text area and CodeMirror code.

Here is my code not sure it helps.

params['action']; ?>() call parameters:

$v) {
if ($k != 'debug' && !empty($v)) {
echo '' . $k . ' => ' . $v . '
';
}
}
}
?>

API response:

<?php
if ($response_type == 'xml') {
// Checks if not empty
if (!empty($response)) {

if (!empty($response->error)) {
// If error
echo $this->Xml->header();
echo $this->Xml->serialize($response, array('format' => 'tags'));

} elseif (!empty($response->success)) {
// Success
echo $this->Xml->header();
echo $this->Xml->serialize($response, array('format' => 'tags'));

} elseif (isset($response->number)) {
//echo $response->number;
// Response returns number
echo $this->Xml->header();
echo $this->Xml->serialize($response->number, array('format' => 'tags'));

} elseif (isset($response->string)) {
if ($response->string != '') {
// Response returns string
//echo $response->string;
// TEMPORARY TODO use well return correct format for response
/* Pure hack to get it working without the string tag */
echo $this->Xml->header();
$tmp = $this->Xml->serialize($response, array('format' => 'tags'));
$tmp = str_replace('<string>','',$tmp);
$tmp = str_replace('</string>','',$tmp);
echo $tmp;

} else {
// Response empty
echo $this->Xml->header();
echo '<error><![CDATA[Sorry there is no data for your current query]]></error>';
}

} else {
// Response returns scores
echo $this->Xml->header();
echo $this->Xml->serialize($response, array('root' => $response_root, 'format' => 'attributes', 'tags' => array('scores', 'score')));
}

} else {
// Response empty
echo $this->Xml->header();
echo '<error><![CDATA[Sorry there is no data for your current query]]></error>';
}
} else {

// JSON
if(isset($response->string)) {
//echo $response->string;
// Response string
echo json_encode($response->string);

} elseif(isset($response->number)) {
//echo $response->number;
// Response number
echo json_encode($response->number);

} else {
if(!empty($response)) {
echo json_encode($response);

} else {
// Response empty
echo json_encode(array('error' => 'Sorry there is no data for your current querry'));
}
}

}
?>

Copy response