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 4 of 4
  1. #1
    New to the CF scene
    Join Date
    May 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    jQuery .Load() style issues

    Hi guys,
    This is my first post here so sorry if something is not right with it.

    I am having a problem that is driving me mad and I just cannot find the answer!

    I am currently using jquery to load an external file into a div so that I can load it into a jquery modal.

    The file works fine, but for some reason the main document is being affected by the css within the external file. The external file is a classic asp file, so all of the styling information is within it, instead of being externally referenced.

    Here is the code I am using in case it helps:

    Code:
    $(function () {                         //Allows the schedule to be an externally referenced file
        $("#SchedulePage").load("/StaffSchedule/Schedule.asp")
         
        
    });
    Does anyone know how to stop the external file from affecting the rest of my page? it is really giving me problems now.

    Thanks

  • #2
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,476
    Thanks
    6
    Thanked 980 Times in 953 Posts
    I assume Schedule.asp is a complete HTML file with header and stuff? You shouldn’t load complete files for that very reason, but the load() function provides a way to load document fragments only: http://api.jquery.com/load/#loading-page-fragments. So, it’s best to use the ID of some container within the body element of that page to load just that part. Then you can style it from the including page.

  • #3
    New to the CF scene
    Join Date
    May 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you,
    That's what I was tihnking of doing, but the problem is that since the external page is a classic asp page, it has all of its vb code at the top, then the style information, then the actual document.

    Is there a way to bring in multiple divs? that way I can bring in the top and bottom but not the style information?

    If that's not possible then is it possible to bring in everything APART from a certain div?
    That way I could wrap the style information in tags and import everything else.

    Does that make sense?

  • #4
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,476
    Thanks
    6
    Thanked 980 Times in 953 Posts
    No, JavaScript is only processing output HTML code, it doesn’t care whether the page is created with ASP, PHP, ColdFusion, or whatever. If you load Schedule.asp in your browser and do “view source”, this is what the load function sees and works with. You only need to get the stuff in the document body, and there shouldn’t be any CSS that can influence the rest of your page. Can you show us the output HTML of Schedule.asp?


  •  

    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
    •