I want to change items of Select2 on change event of Select1.Select1's On Change event runs PHP script:
$result = mysql_query('SELECT id, name FROM mytable');print ('<?xml version="1.0" encoding="ISO-8859-1"?>');print ('<list>');while ($row = mysql_fetch_array($result)) { print ('<listitem>'); print ('<id>' . $row['id'] . '</id>'); print ('<text>' . $row['name'] . '</text>'); print ('</listitem>'); } print ('</list>');
I'm loading as it stays on w3schools (for Firefox):
var xmlFileUrlxmlFileUrl = 'script/generate-xml.php'//xmlFileUrl = 'localhost/test.xml'xmlDoc = document.implementation.createDocument("","",null)xmlDoc.load(xmlFileUrl)xmlDoc.onload=getmessage
And getmessage function is:
alert(xmlDoc.documentElement.nodeName)
It works fine when XML file is loaded from localhost, but when I try to get it from the gerator script I get this error message: Error: xmlDoc.documentElement has no propertiesIt looks like generated XML file is not even loaded into xmlDoc. Why is taht (it all works for IE both ways)? What should I do?