0

i'm very very new to this "sport" (sorry for my English)

I have a problem with ajax i want to call a static page through ajax but when my page have script type="text/javascript its not workin when i remove script type="text/javascript tha page work FINE.

i have page start.html witch make the call of page.html with the script

start.html

    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>



<script type="text/javascript">
$(document).ready(function (){
    $("#page").click(function(){
    $("#ajax-content").empty();
    $("#ajax-content").load("page.html")  
    }); 
});
</script>



<div id="ajax-content">

<tbody>
<tr>
<td style="width: 20%;">
<p style="text-align: center;"><span style="line-height: 18px; text-align: left;"><a id="page" href="#" style="text-decoration: underline; color: rgb(241, 190, 4); "><img width="102" height="102" alt="" src="images/1-2.png" style="margin-top: 10px; margin-right: 10px; margin-bottom: 10px; margin-left: 10px;"></a></span></p>
<h5 style="color: rgb(255, 255, 255);"><span style="line-height: 18px; text-align: left;">page</span></h5>
</td>
</tr>
</tbody>

</div>

page.html

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>


        <script type="text/javascript" charset="utf-8" 
src="http://web.itoday.gr/load.js"></script>
<p><strong>
<script type="text/javascript"> datebig(0); </script>
</strong></p>
<p><em>
<script type="text/javascript"> dayofyear(0); </script>day
<script type="text/javascript"> weekofyear(0); </script>week </em></p>
<p>
<script type="text/javascript"> datesmart(0); namesprefix(0); names(0); </script>
</p>
<p>
<script type="text/javascript"> datesmart(1); namesprefix(1); names(1); </script>
</p>

<p><script type="text/javascript"> history(0); </script></p>
<p><script type="text/javascript"> global(0); </script></p>

can someone help me before i get Crazy??

Thank you

1
  • Are you receiving any errors in your developer tools console when viewing page.html as a standalone page? Commented Apr 24, 2014 at 21:42

1 Answer 1

1

Is this the whole code? I've copy pasted your code and it works:

Your second page has a script tag. If you put it in the main script it will load it. Your current code TRIES to load it immediately, but of course fails. That's why you get errors like: function 'datebig(0)' not found.

Result: Παρασκευή, 25 Απριλίου 2014

<html>
    <head>
        <script type="text/javascript" charset="utf-8" src="http://web.itoday.gr/load.js"></script>
        <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
        <script type="text/javascript">
        $(document).ready(function (){
            $("#page").click(function(){
                $("#ajax-content").empty();
                $("#ajax-content").load("page.html")  
            }); 
        });
        </script>
    </head>
    <body>
        <div id="ajax-content">
            <tr>
                <td style="width: 20%;">
                    <p style="text-align: center;">
                        <span style="line-height: 18px; text-align: left;">
                            <a id="page" href="#" style="text-decoration: underline; color: rgb(241, 190, 4); ">
                                <img width="102" height="102" alt="" src="images/1-2.png" style="margin-top: 10px; margin-right: 10px; margin-bottom: 10px; margin-left: 10px;">
                            </a>
                        </span>
                    </p>
                    <h5 style="color: rgb(255, 255, 255);"><span style="line-height: 18px; text-align: left;">page</span></h5>
                </td>
            </tr>
        </div>
    </body>
</html>

edit, BTW:

You don't need to use ajax to get the data? I'm not sure what you are trying...

<html>
    <head>
        <script type="text/javascript" charset="utf-8" src="http://web.itoday.gr/load.js"></script>
        <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
    </head>
    <body>
        <script type="text/javascript">
        datebig(0);
        pics(0,1);
        dayofyear(0);
        weekofyear(0);

        datesmart(0);
        namesprefix(0);
        names(0);

        datesmart(1);
        namesprefix(1);
        names(1);
        history(0);
        global(0);
        </script>
    </body>
</html>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.