Results 1 to 3 of 3

Thread: Loading a Page

  1. #1
    Join Date
    Mar 2010
    Location
    Florida
    Posts
    512
    Thanks
    9
    Thanked 61 Times in 59 Posts

    Default Loading a Page

    So I have a few questions. The first is I am trying to load a page into a website and I can get it to work doing this:

    Code:
    $(document).on({
    	click:function(){
    		$(this).hide()
    		loadObject()
    		//setInterval(loadObj, 3000);
    	}
    },'#loadItem')
    
    function loadObject(){
    	$.get( "../Gabe%20and%20Our%20Website/index.html", function( data ) {
    			var area = '../Gabe%20and%20Our%20Website/'
    			var head_start = data.indexOf('</title>')+("</title".length+1)
    			var head_end = data.indexOf('</head>')
    			var head_html = data.substring(head_start, head_end);
    			
    			head_html = head_html.replace(/src="+/g, 'src="'+area+'');
    			head_html = head_html.replace(/href="+/g, 'href="'+area+'');
    			
    			var body_start = data.indexOf('<body>')+('<body>'.length+1)
    			var body_end = data.indexOf('</body>')
    			
    			var body_html = data.substring(body_start, body_end)
    			
      			$( "#loader" ).html(head_html+body_html);
    			
    		});
    }
    First problem is that I need to keep reloading the page; however, it saves the page. I am assuming it is from the cache. Is there a way to stop that?

    Also I cant get my setInterval to work once i click on #loadItem. Any ideas?
    Last edited by Deadweight; 05-12-2015 at 12:33 AM.
    -DW [Deadweight]
    Resolving your thread: First Post: => EDIT => Lower right: => GO ADVANCED => Top Advance Editor drop down: => PREFIX:Resolved

  2. #2
    Join Date
    Mar 2010
    Location
    Florida
    Posts
    512
    Thanks
    9
    Thanked 61 Times in 59 Posts

    Default

    Update:
    I now use this:
    Code:
    $.ajax({
    		url:'../Gabe%20and%20Our%20Website/index.html',
    		cache: false,
    		dataType:"html",
    		success: function(data){
    			var area = '../Gabe%20and%20Our%20Website/'
    			var head_start = data.indexOf('</title>')+("</title".length+1)
    			var head_end = data.indexOf('</head>')
    			var head_html = data.substring(head_start, head_end);
    			
    			head_html = head_html.replace(/src="+/g, 'src="'+area+'');
    			head_html = head_html.replace(/href="+/g, 'href="'+area+'');
    			
    			var body_start = data.indexOf('<body>')+('<body>'.length+1)
    			var body_end = data.indexOf('</body>')
    			
    			var body_html = data.substring(body_start, body_end)
    			
      			$( "#loader" ).html(head_html+body_html);
    		}
    	})
    But i cant get the setInterval to work. (when not commented out)
    -DW [Deadweight]
    Resolving your thread: First Post: => EDIT => Lower right: => GO ADVANCED => Top Advance Editor drop down: => PREFIX:Resolved

  3. #3
    Join Date
    Mar 2010
    Location
    Florida
    Posts
    512
    Thanks
    9
    Thanked 61 Times in 59 Posts

    Default

    Nevermind i was jumping ahead of myself i got it:
    Code:
    setInterval(function () {loadObject()}, 5000);
    -DW [Deadweight]
    Resolving your thread: First Post: => EDIT => Lower right: => GO ADVANCED => Top Advance Editor drop down: => PREFIX:Resolved

Similar Threads

  1. loading a php page
    By woodplease in forum Dynamic Drive scripts help
    Replies: 0
    Last Post: 09-23-2010, 12:45 PM
  2. Resolved Loading JavaScript before page loading?
    By blastbb in forum JavaScript
    Replies: 2
    Last Post: 04-04-2009, 01:31 PM
  3. disable page options while loading page
    By vikrant in forum PHP
    Replies: 2
    Last Post: 12-04-2008, 11:35 AM
  4. Page loading .....
    By rajan.krishnan in forum JavaScript
    Replies: 0
    Last Post: 01-21-2008, 12:41 PM
  5. Replies: 0
    Last Post: 05-27-2005, 03:26 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •