I have a basic directive on an MVC 5 layout page with a search directive. My problem is that templateUrl could not be loaded (error 400). If I enter the URL directly into the browser, I can load the html page without difficulty or error. I cannot understand why the AJAX call to load the page does not work.
Chrome debugger 
This is loading an HTML page in Chrome

app.js
(function() { var app = angular.module("mainApp"); app.directive("basicSearch", function() { return { templateUrl: 'app/directives/basic-search.html', controller: function($scope, search) { $scope.keyword = ''; $scope.exact = false; $scope.submitSearch = function () { search.searchByKeyword($scope.keyword, 0, $scope.exact); } } } }); }());
base-search.html
<div> <input type="search" ng-model="keyword" name="keyword" /> <button type="submit" ng-click="submitSearch()"></button> <input type="checkbox"ng-model="exact" name="exact" /> <label for="exact">Exact Match?</label> </div>
_Layout.cshtml
<html> <head> <base href="@Request.ApplicationPath" /> <title></title> </head> <body ng-app="mainApp"> <basic-search></basic-search> @RenderBody() </body> </html>
EDIT Here is a successful request (via browser): 
and here is the one that fails (via the Angular directive): 
source share