Need help with a script...

nachtruhe

New Member
Alright, I'm rather old at JavaScript -- I haven't fiddled with it in the longest time. I need someone to help me out with something.
I know what document.write does, but it doesn't help me with my goal: I want to be able to manipulate specific files on my server.

Let me clarify this -
I want to set up a specific directory where I will allow my users to manipulate files. More specifically, I want to allow them to manipulate the text on 1 file (for example, userhome.html). I know one can do this using AJAX, as I have been able to switch the displayed content of one of my pages with an AJAX script.

err... here is the source code I am using right now:

Code:
function ajaxLoader(url,id) {
  if (document.getElementById) {
    var x = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
  }
  if (x) {
    x.onreadystatechange = function() {
      if (x.readyState == 4 && x.status == 200) {
        el = document.getElementById(id);
        el.innerHTML = x.responseText;
      }
    }
    x.open("GET", url, true);
    x.send(null);
  }
}

here is the HTML page:
Code:
<html>
<head>
<script type="text/javascript" src="ajaxLoader.js"></script>
<style>@import url("mystyle.css");</style>
</head>
<body onload="ajaxLoader('demo.html','contentLYR')">
This is a test page/script. :)
<input type="button" value="Demo Page 1" onClick="ajaxLoader('demo.html','contentLYR')">
<input type="button" value="Demo Page 2" onClick="ajaxLoader('demo2.html','contentLYR')">
<input type="button" value="Demo Page 3" onClick="ajaxLoader('index.html','contentLYR')">
<div id="contentLYR">
</div>
</body>
</html>

I want the users to be able to edit the "demo.html", "demo2.html" and "demo3.html" files.
The page can be found at http://www.enderia.net/ulrin.com/index/test.html and I appreciate all replies (even those who tell me I'm an idiot -- at least I got noticed and you're keeping this thread alive so somebody with the intellect I require can find it ^^)
 

edowereld

New Member
What exactly are you trying to accomplish?

- Do you want to change the content of the page you're on or another page?
- Do you want to change the site content permantently or just temporary?

I'm definitely not an expert at this, so correct me if I'm wrong!
Using a javascript framework like jquery or mootools makes dealing with AJAX a lot easier.
If you want to store data (your new content) on the server you'll need to use a server side language like PHP or ASP.

Maybe if you give a better explanation, me or some else can help you.
(Your link is death)

Good luck!
 

uptownhr

New Member
Yea, it would be nice if you can share what you exactly trying to accomplish. Is this something that can be done from a DB?
 
Top