Jump to content

Problem updating div which contains javascript


dr.pepper

Recommended Posts

Ive currently got a html page and a button which when pressed replaces a div within the page with html from another page. Please see below for an example:

 

<html>
<header>
<script>
	jQuery.noConflict();

      	jQuery(document).ready(function() {
      
       	jQuery("#formID").validationEngine()
       	
        });
        
        function ajax_request(divId, url) {

    		jQuery('#'+divId).load(url, "",
    		
        	function(responseText, textStatus, XMLHttpRequest) {
        	
        		jQuery('#'+divId).hide()
        		jQuery('#'+divId).fadeIn("slow");

            		if(textStatus == 'error') {
                		jQuery('#'+divId).html('<p>There was an error making the AJAX request</p>');
            		}
        		}
    		);
   
	}

</script>
<body>

<input type="button" value="edit" onclick="ajax_request('test', '/test_page.php')">

<div id="test"></div>

</body>
</header>
</html>

 

The test_page.php page was just html and was working fine, however I have added javascript tags for a postcode finder within the page and now it no longer loads.

 

E.g

 

The test_page.php page used to consist of the following and worked fine:

 

<p>This is a test</>

 

Now it consists of the following and doesnt work:

 

<p>This is a test</>
<SCRIPT LANGUAGE="JAVASCRIPT" SRC="XXXXX"></SCRIPT>

 

When I click the button to load the new page into the div it now displays a white blank page with just the button from the javascript (Click here to find postcode button) showing in the top left corner. Any idea how to fix this?

 

Archived

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

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.