In Progress

Ajaxified page, help needed to improve code

I have put together some code from various sources but javascript is somewhat unknown to me and I only seem to fail with the code I have so far..

What I want to do is convert every normal link on the page to ajax links and load the pages through ajax.

So far I only succeeded to transform the links from the initial page and load the content in a div. The problem is I don't have access to the content is loading in the div and the new content still has normal links instead of ajax.

What I need help for is:

The Home page holds the menu and content div.

-I want to convert the new links within the content loaded in the div, every time the div changes.

-Also if the user clicks on the home button in the menu, it will load the content of index along with this script, and everything will become a loop. Find a way to prevent loading the home page in the div, and paste instead a custom text.

-Add a loading gif and animate the load (fast fade)

If you suspect any other problems it may occur from this code can you please advice me what to change?

This is the code I have so far..

Inserted in the head tag:

<script type="text/javascript">

var xmlhttp;

if([url removed, login to view]) { xmlhttp=new XMLHttpRequest(); }

else if([url removed, login to view]){ xmlhttp=new ActiveXObject("[url removed, login to view]"); }

else{ }

xmlhttp.onreadystatechange=function(){

if(xmlhttp.readyState==4)

{ [url removed, login to view]("contentarea").innerHTML = [url removed, login to view]; }

else{ [url removed, login to view]("contentarea").innerHTML = ""; }

}

function loadPage(url){

[url removed, login to view]("contentarea").innerHTML = "";

[url removed, login to view]("GET",url,true);

[url removed, login to view](null);

}

</script>

Inserted somewhere in the body:

<div id="contentarea"></div>

Inserted right before the body ends:

<script>

var oP = [url removed, login to view]("a");

var ctr=0;

while(ctr < [url removed, login to view]){

var oldHref = [url removed, login to view]("a")[ctr].href;

[url removed, login to view]("a")[ctr].href="javascript:loadPage('"+oldHref+"');";

ctr++;

}

</script>

Skills: AJAX, jQuery / Prototype

See more: xmlhttp readystate 0, prototype help, problems page, page problem, if xmlhttp.readystate 4, get right code, get prototype, find in page, find help, find animate, fast head, div problems, convert gif to text, loading gif, ctr, convert to ajax, send ajax button, prototype needed script, xmlhttprequest, jquery instead, ajax fade, code convert javascript code, content loaded, load ajax pages, load page javascript

About the Employer:
( 5 reviews ) Bucharest, Romania

Project ID: #1521994

7 freelancers are bidding on average $45 for this job

canlan318

Dear sir. I sent you a private message. Please check it. Regards.

$50 USD in 1 day
(56 Reviews)
6.4
kharota

Ready to do it now. please check your pmb.

$50 USD in 2 days
(22 Reviews)
4.6
websoft333

I am ready for this task now. Plz check PMB.

$40 USD in 1 day
(2 Reviews)
2.7
freelancer4142

Hi, I have read your complete statement and I have faced the same problem many weak ago. I can complete this work. Waiting for a positive response. Thank you.

$50 USD in 1 day
(0 Reviews)
0.0
hitesh234

please check pmb.

$30 USD in 0 days
(0 Reviews)
0.0
dkcwebmaster

Hi, We hav gone through the [url removed, login to view] can do it.

$45 USD in 1 day
(0 Reviews)
0.0
ankitd1

Hi, I am an expert in Jquery, Javascript and ASP .NET.

$50 USD in 5 days
(0 Reviews)
0.0