/    Sign up×
Community /Pin to ProfileBookmark

I have a external file that hold my XML

but i am having problems reading this file.

does any one have any good code that can read this.

my file name is always going to be myXML.xml and is the the same directory as my web site

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@moiseszaragozaauthorJun 13.2007 — what i have now is a asp function reading the file and passing it to JS in a response. write()

but it's not really working properly


[CODE] <% call readFile() %>


<%
sub readFile()


dim fs,f,ts
set fs=Server.CreateObject("Scripting.FileSystemObject")
Set f=fs.GetFile("pathmyXML.xml")
Set ts=f.OpenAsTextStream(1)



Response.Write("<script language='javascript'>")
'Response.Write(" ReturnXml2('String literal') ")
'Response.Write(" setTimeout(ReturnXml2('ts.ReadAll'), 5000); ") ' This works
Response.Write(" setTimeout(ReturnXml2('"&ts.ReadAll&"'), 1000); ")
Response.Write("</script>")
'Response.Write(ts.ReadAll)

ts.Close
set ts=nothing
set f=nothing
set fs=nothing


end Sub

%>


[CODE]

<script language="javascript">
function saveXml (myText) {
var url2 = 'saveFile.asp';
var xmldoc="xmldoc="+encodeURI(myText);
if (window.XMLHttpRequest) { // Mozilla
objHTTP=new XMLHttpRequest();
} else if (window.ActiveXObject) { //IE
objHTTP=new ActiveXObject('Microsoft.XMLHTTP');
}

[/CODE]

[/CODE]
Copy linkTweet thisAlerts:
@A1ien51Jun 13.2007 — You do not have to crate a new thread when you already have one on the same topic

http://webdevelopers.com/forum/showthread.php?p=764251&posted=1#post764251

I added an answer there...

Eric
×

Success!

Help @moiseszaragoza spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.1,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...