javascript - contentType error on chrome -


getting weird errors :

resource interpreted stylesheet transferred mime type text/html: "http://localhost:8000/search/static/css/style.css". localhost/:4 resource interpreted script transferred mime type text/html: "http://localhost:8000/search/static/js/endless_on_scroll.js". localhost/:119 resource interpreted script transferred mime type text/html: "http://localhost:8000/search/static/js/endless-pagination.js". localhost/:119 uncaught syntaxerror: unexpected identifier endless_on_scroll.js:1 uncaught syntaxerror: unexpected identifier endless-pagination.js:1 uncaught typeerror: object function ( selector, context ) {         // jquery object init constructor 'enhanced'         return new jquery.fn.init( selector, context, rootjquery );     } has no method 'endlesspaginate' ?keyword=women:123 

i have django app using same template 2 views first view working fine second view giving me error .... can please .. know question been asked nothing working far .....if want see code let me know long haven't pasted here....

code :

views.py :

import json import traceback django.http import httpresponse django.template import context,loader django.template import requestcontext django.shortcuts import render_to_response escraperinterfaceapp.escraperutils import escraperutils   #------------------------------------------------------------------------------  def rendererror(message):     """         function displays error message     """         t = loader.get_template("error.html")                     c = context({ 'message':message})     return httpresponse(t.render(c))   def index(request,template = 'index.html',                   page_template = 'index_page.html' ):     """         function handles request index page      """      try:                 context = {}         contextlist = []         utilsobj = escraperutils()                 q = {"size" : 300000,              "query" :{ "match_all" : { "boost" : 1.2 }}}         results = utilsobj.search(q)                 in results['hits']['hits']:              contextdict = i['_source']                         contextdict['image_paths'] = json.loads(contextdict['image_paths'])             contextlist.append(contextdict)                      context.update({'contextlist':contextlist,'page_template': page_template})               if request.is_ajax():    # override template , use 'page' style instead.             template = page_template          return render_to_response(             template, context, context_instance=requestcontext(request) )      except :                 return rendererror('%s' % (traceback.format_exc()))  def search (request,template = 'index.html',                   page_template = 'index_page.html' ):          try:         context = {}         contextlist = []         utilsobj = escraperutils()         keyword = request.get['keyword']                    results = utilsobj.search('productcategory:%(keyword)s or productsubcategory:%(keyword)s or productdesc:%(keyword)s' % {'keyword' : keyword})          in results['hits']['hits']:             contextdict = i['_source']             contextdict['image_paths'] = json.loads(contextdict['image_paths'])                contextlist.append(contextdict)                      context.update({'contextlist':contextlist,'page_template': page_template})         if request.is_ajax():                    # override template , use 'page' style instead.             template = page_template          return render_to_response(             template, context, context_instance=requestcontext(request) )         except :                 return rendererror('%s' % (traceback.format_exc()))  #------------------------------------------------------------------------------      

index.html :

<html> <head>     <title>fashion</title>     <link rel="stylesheet" type="text/css" href="static/css/style.css"> </head> <body>  <form action="/search/" method='get'>     <input id="keyword" type="text" name="keyword"/>     <input id="search-submit" type="submit" value="search" />     </form>  <div class="product_container">     <ul class="product_list">         <div class="endless_page_template">             {% include page_template %}         </div>     </ul> </div>   {% block js %} <script src="http://code.jquery.com/jquery-latest.js" type="text/javascript"></script>   <script src="static/js/endless_on_scroll.js" type="text/javascript"></script> <script src="static/js/endless-pagination.js" type="text/javascript"></script>     <script type="text/javascript">     $.endlesspaginate({paginateonscroll: true,     endless_on_scroll_margin : 10,     paginateonscrollchunksize: 5 });</script> {% endblock %}  </body> </html> 

index_page.html :

{% load endless %} {% paginate 10 contextlist %} {% item in contextlist %}     <li style="list-style-type: none;" >         <a href="{{ item.producturl }}" ><img src="/images/{{ item.image_paths.0 }}/" height="100" width="100" border='1px solid'/></a>         <br>         <span class="price">         <span class="mrp">mrp : {{ item.productmrp}}</span>         {% if item.productprice %}<br>         <span class="discounted_price">offer price : {{ item.productprice}}</span>         {%endif%}         </span>     </li>   {% endfor %}  {% show_more "even more" "working" %} 

style.css :

.product_list  {     margin:0;     padding:0; }   .product_list li {     margin:0;     padding:0;     height:150px;     margin-bottom:5px; }  .product_container {     width:800px;     column-gap: 0;     column-count: 2;     -moz-column-gap: 0;     -moz-column-count: 2;     -webkit-column-gap: 0;     -webkit-column-count: 2; } 

try after changing :

<script src="/static/js/endless_on_scroll.js" type="text/javascript"></script> <script src="/static/js/endless-pagination.js" type="text/javascript"></script>    

and

<link rel="stylesheet" type="text/css" href="/static/css/style.css"> 

Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -