page.xml.php will not show any output, in firebug I can see the get response for page.xml.php with my class responsible for extracting the data isn't seeing the content as xml data
How can i get this to work?
index.php
// Load config file
$config = simplexml_load_file("resources/pinboard/config.xml.php");
page.xml.php
<?php header("Content-type: text/xml"); ?>
...
<module name="Weather" id="23">
<title>Weather</title>
<location><?php echo $_COOKIE['zip_code']; ?></location>
</module>
...
weather.php
...
protected $default_config = array(
'title' => 'Weather',
'refresh' => '200000', // Every 20 minutes
'location' => "Los+Angeles",
'format' => 'f'
);
...
site.js
...
$.ajax({
type: "GET",
url: "resources/pinboard/config.xml.php?" + new Date().getTime(),
dataType: "xml",
success: function(xml) {
开发者_运维问答 // Parse config
$(xml).find('settings').children().each(function(test){
settings[$(this)[0].localName] = $(this).text();
});
// Call init (startup the picboard)
init();
}
});
...
Your loading your xml.php
file with
$config = simplexml_load_file("resources/pinboard/config.xml.php");
But that would not return a parsed file, just the source. Now I don't know if your other xml.php files are loaded like that, -but you need to "go trough the webserver" for it to work.
The ajax call does seem correct though.
As suggested in the comments:
use more sensible application structure
精彩评论