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 7 of 7
  1. #1
    New to the CF scene
    Join Date
    Oct 2012
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts

    my html code just works in FireFox

    Hello everyone!
    I'm a new member of this forum.
    Is there anyone can help me?
    My html code, just works in FireFox and it doesn't work in IE or Chrome; what should I do to solve this problem?
    I'm so appreciate.
    I wrote my code in blew:


    <!DOCTYPE html>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <link rel="stylesheet" type="text/css" href="style.css" >
    <script type="text/javascript" src="jquery.js"></script>

    <script>
    $(document).ready(function(){
    content="<ul class='content-menu' id='post_list'>";
    $.getJSON("data.json",function(data){
    $.each(data.post,function(i,data){
    content+="<li class='content-sub-menu'><div class='article'><h4 class='article-header'><a class='article-header-link' href='#tips'>"+data.header+"</a></h4><p class='article-body'>"+data.article+"</p><img class='picture' src='"+data.image+"'/></div></li>";

    });
    content+="</ul>";
    document.getElementById('post').innerHTML = content;
    });
    });
    </script>

    </head>

    <body>
    <div id="post"></div>
    </div>
    </body>

    </html>

  • #2
    Regular Coder
    Join Date
    Apr 2012
    Location
    St. Louis, MO
    Posts
    985
    Thanks
    7
    Thanked 101 Times in 101 Posts
    With just a cursory glance, rename your div to something that isn't a reserved word ("post").
    ^_^

    If anyone knows of a website that can offer ColdFusion help that isn't controlled by neurotic, pedantic jerks* (stackoverflow.com), please PM me with a link.
    *
    The neurotic, pedantic jerks are not the owners; just the people who are in control of the "popularity contest".

  • #3
    New to the CF scene
    Join Date
    Oct 2012
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thank you so much for your recommendation. I changed div id with another name (with "matn"). but it doesn't work in chrome browser again
    I think it depend on my browser setting, isn't it?
    Last edited by aref; 10-01-2012 at 02:08 PM.

  • #4
    Regular Coder
    Join Date
    Apr 2012
    Location
    St. Louis, MO
    Posts
    985
    Thanks
    7
    Thanked 101 Times in 101 Posts
    Check the data that is being returned to make sure it's in the format you are expecting.
    ^_^

    If anyone knows of a website that can offer ColdFusion help that isn't controlled by neurotic, pedantic jerks* (stackoverflow.com), please PM me with a link.
    *
    The neurotic, pedantic jerks are not the owners; just the people who are in control of the "popularity contest".

  • #5
    New to the CF scene
    Join Date
    Oct 2012
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts
    which returned data? data gotten from JSon file?
    if it's wrong why it work well in FireFox and now in IE?
    it just doesn't work in Chrome?
    when I allow script and Activex run in IE, my data shows in IE, but in Chrome browser, script is allow and it doesn't work too??!!

  • #6
    New to the CF scene
    Join Date
    Oct 2012
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts
    look at this:

    XMLHttpRequest cannot load file:///C:/Users/hp/Desktop/Project01/main-JSon/data.json. Origin null is not allowed by Access-Control-Allow-Origin.
    Profile "Profile 1" started.

    I found it in my Chrome when I run my web page in it.
    how can I fix it?
    is there anyone can help me?

  • #7
    Senior Coder
    Join Date
    Dec 2010
    Posts
    2,395
    Thanks
    12
    Thanked 569 Times in 562 Posts
    Your page must be on a webserver (together with the JSON file) in order to enable Chrome to read the JSON file. The file:/// access is considered a cross origin request if you didn't open Chrome up with the option --allow-file-access-from-files

  • Users who have thanked devnull69 for this post:

    aref (10-02-2012)


  •  

    Posting Permissions

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