Changeset - 3ec1ad3d78a8
[Not reviewed]
default
0 2 0
Branko Majic (branko) - 10 years ago 2013-10-26 21:37:57
branko@majic.rs
CONNT-23: Dynamically set-up the base URL for AJAX calls.
2 files changed with 5 insertions and 1 deletions:
0 comments (0 inline, 0 general)
conntrackt/static/conntrackt.js
Show inline comments
 
@@ -34,13 +34,13 @@
 
        var searchSuggestions = $("#search-suggestions");
 
        var searchSuggestionsList = searchSuggestions.find("ul");
 

	
 
        // Show the search suggestions only if the user has provided 2 or more
 
        // characters.
 
        if (searchField.val().length >= 2) {
 
            request = $.getJSON("/conntrackt/api/search/" + searchField.val())
 
            request = $.getJSON(conntrackt_api_url + "/search/" + searchField.val())
 
                .done(function(data) {
 

	
 
                    // Process the retrieved JSON response, setting-up list of
 
                    // items that will be offered as suggestion.
 
                    var items = [];
 
                    $.each(data, function(index, item) {
conntrackt/templates/conntrackt/base.html
Show inline comments
 
@@ -11,12 +11,16 @@
 
    body {
 
      padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
 
    }
 
    </style>
 
    <link href="/static/bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
 
    <link href="/static/custom.css" rel="stylesheet">
 
    <script>
 
    /* Set-up the base URL for sending out AJAX API calls. */
 
    var conntrackt_api_url = location.protocol + "//" + location.hostname + ":" + location.port + {% url "index" %} + "api";
 
    </script>
 
  </head>
 
  <body>
 

	
 
    <div class="navbar navbar-inverse navbar-fixed-top">
 
      <div class="navbar-inner">
 
        <div class="container">
0 comments (0 inline, 0 general)