Thursday, September 27, 2012

Regarding Template rendering



I am new to django, iam facing some issue with template ,


i am having tabs,on click of each tab  i need to load the template with the help of ajax. this is working fine if i use this script code in same html file, 
As per my requirement i have to use the external javascript file to maintain all the scripts . so i moved  this whole script to external js file then template was not loading I dont have any clue on this. can any one guys help me out in this.


<html>
<header></header>
<section>

<section>

<script type="text/javascript">

    $(function () {
        $("#abc").click(function () { 
        $("#content").load('{% url abcpage_ajax %}');
       
        $(this).addClass('active');
        $("#def").removeClass('active').addClass('inactive');
        $("#fgh").removeClass('active').addClass('inactive');
        return false;
        });
        
        $("#def").click(function () { 
        $("#content").load('{% url cdepage_ajax %}');        
   
        $("#abc").removeClass('active').addClass('inactive');
        $(this).addClass('active');
        $("#fgh").removeClass('active').addClass('inactive');
        return false;
        });
  
        $("#fgh").click(function () { 
        $("#content").load('{% url create_reports_ajax %}');
        
        $("#abc").removeClass('active').addClass('inactive');
        $("#def").removeClass('active').addClass('inactive');
        $(this).addClass('active');
        return false;
        });
        
 
    });
     
</script>
        
        
        <div id="content" class="content"> <!-- content -->

            <div class="ipad-text">

                <h4>&nbsp;</h4>

              <p> data</p>
                <a class="button long morebtn" href="{% url abcpage %}"> button</a>

            </div>

           

        </div>    <!-- END content -->

    </section>

 
</html>


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/50tg9dE8QTcJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment