Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Nov 2011
    Location
    London
    Posts
    31
    Thanks
    5
    Thanked 1 Time in 1 Post

    The ajax part of this code does not work

    Code:
    function dimensions(){
        $('.resource-container').css("width",($(window).width() - 306) + 'px');
        $('.resource-title').css("width",($(window).width() - 366) + 'px');
        $('.resource-container').css("height",($(window).height() - 250) + 'px');
        $('.resource-content ul').css("height",($(window).height() - 292) + 'px');
        $('.resource-iframe').css("width",($(window).width() - 306) + 'px');
        $('.resource-iframe').css("height",($(window).height() - 275) + 'px');
    }
    function resourcego(id){
    	$.ajax({
            url: "http://glynit.co.cc/resource.php?id=" + id + "&item=list&part=name",
            cache: false,
            success: function(data){
    			name = data;
            	$.ajax({
            		url: "http://glynit.co.cc/resource.php?id=" + id + "&item=list&part=list",
            		cache: false,
            		success: function(data){
            			list = data;
    					$('.resource-toolbar').html('<div id="resource-title" class="resource-title">' + name + '</div>');
    					$('.resource-content').html('<div class="resource-list"><ul>' + list + '</ul></div>');
                        dimensions();
    				}
    			});
            }
    	});
    }
    function viewresource(id,ref){
        $.ajax({
            url: "http://glynit.co.cc/resource.php?id=" + id + "&content=name",
            cache: false,
            success: function(data){
    			name = data;
                $('.resource-toolbar').html('<div id="resource-back" class="resource-back" onclick="resourcego(' + ref + ');">Back</div><div id="resource-title" class="resource-title">' + name + '</div><div id="resource-print" class="resource-print">Print</div>');
    						$('.resource-content').html('<iframe id="resource-iframe" class="resource-iframe" src="http://glynit.co.cc/resource.php?id=' + id + '&content=content"></iframe>');
                            dimensions();
            }
    	});
    }
    $(window).load(function() {dimensions();});
    $(window).resize(function() {dimensions();});
    The webiste is http://www.glynit.co.cc/
    and the login is guest:guest
    And the page is the resources page and it is the links on the left of that page that do not work.

  • #2
    Senior Coder Logic Ali's Avatar
    Join Date
    Sep 2010
    Location
    London
    Posts
    1,028
    Thanks
    0
    Thanked 207 Times in 202 Posts
    You're not monitoring for failure. Your url must contain www. or it is classed as a cross-domain communication attempt. If you log-in without www you'll see that it works.
    If it will work using a relative path, use it.


  •  

    Tags for this Thread

    Posting Permissions

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