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?

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.