Jump to content

my script won't load [SOLVED]


echofool

Recommended Posts

Hey,I have a js script which is meant to load a php script inside a div, i get no Js errors according to firebug so i don't know why it won't do it.My script is:

function createRequestObject() {var ro;if (window.XMLHttpRequest)  {// code for IE7+, Firefox, Chrome, Opera, Safariro =  xmlhttp=new XMLHttpRequest();  }else  {// code for IE6, IE5  ro = xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");  }return ro;}var http = createRequestObject();function updateShouts(){	$('#Div').load('content.php');}window.onload = updateShouts();

My page source shows:

<script type="text/javascript" src="loaddivcontent.js"></script><div id="Div"></div>

Any one see any mistake i made?

Link to comment
Share on other sites

what do you mean loading a PHP script into a div? You realize PHP is executed before HTTP, correct? I could see if you were returning something from a PHP script and then setting the responseText to the innerHTML of a div. What does content.php do?

Link to comment
Share on other sites

The content.php loads a layout also has some mysql and php stuff going on that works out what layout it is going to be displayed.Content.php is not the same .php script as the which contains the div that is calling it.. the <div id="Div"> is on index.php.Hope this explains.

Link to comment
Share on other sites

Argh i got it work now ! Not sure why it works now and did not before unless my browser cached the JS or something! Thanks for your time on helping!!Cheers.
If the change you made was in the external JS file it was likely cached.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...