View Full Version : function importXML('test.xml'); this works but...

01-25-2006, 06:42 AM
hi sir h r u?
sir i am facing very seriouse prg plz help me i have function i.e
var test_array = new Array();
function importXML(file_name)
var temp_var = new Array();

if (document.implementation && document.implementation.createDocument)
xmlDoc = document.implementation.createDocument("", "", null);
xmlDoc.onload = createTable;
else if (window.ActiveXObject)
xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.onreadystatechange = function () {
if (xmlDoc.readyState == 4)
temp_var = createTable()
for(i = 0; i < temp_var.length; i++) {
if(temp_var[i] != ''){


alert('Your browser can\'t handle this script');

return test_array;

i call this function like this

function importXML('test.xml');

"this function works very fine but the requirement is this i have to give this code to my client and he can run this but he have to get xml file from my server like this"

function importXML('http://www.naeembhatti.com/test.xml');
it does not work for him and display the error in javascript "access denied", i think when he can't access the file then he display this error but when i use this code in my domain(www.naeembhatti.com) it works fine.

my question is give me a solution to XmlLoad('www.naeembhatti.com/test.xml'); and it will work how?
plz plz help me i have deadline tom.

01-25-2006, 10:09 AM
JavaScript has a security policy based on only allowing scripts access to resources from the same domain (The Same Origin Policy). So there is no solution to this other than putting the resources you want to access and the page you want to access them on the same domain.

01-25-2006, 04:10 PM
Look into this: http://ajaxextended.com/