Trying to do a Jquery function, everything seems to be setup fine, but I get this error in my browser console log
SCRIPT5009: 'jQuery' is not defined bootstrap.js (20,1)
HTML1300: Navigation occurred. 1 (1,1) 2 CSS3121: The media query -ms-viewport has been deprecated.
SCRIPT5009: SCRIPT5009: 'jQuery' is not defined bootstrap.js (21,1)
SCRIPT5009: SCRIPT5009: '$' is not defined SendEmail.js (1,1)
This is my View Scripts/Styles:
@model Linkofy.Models.EmailAccount
@{
ViewBag.Title = "SendMail";
}
@section Styles {
<link href="@Url.Content("~/Styles/Edit.css")" rel="stylesheet" type="text/css" />
}
@section Scripts {
<script src="@Url.Content("~/Javascript/SendEmail.js")"></script>
}
My Function (SendEmail.js):
$("#templateName").on("change", function () {
var tempID = $(this).find('option:selected').val();
var url = "/Identifiers/TemplateData/" + tempID;
console.log()
$.ajax({
type: "GET",
dataType: "json",
contentType: "application/json",
url: url, // Variabel
showLoader: true,
success: test // Function
});
});
function test(data) {
data = $.parseJSON(data);
$('#subject').val(data.subject);
$('#body').val(data.body);
}
Bundles:
// For more information on bundling, visit https://go.microsoft.com/fwlink/?LinkId=301862
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery.js"));
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
"~/Scripts/jquery.validate"));
// Use the development version of Modernizr to develop with and learn from. Then, when you're
// ready for production, use the build tool at https://modernizr.com to pick only the tests you need.
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
"~/Scripts/modernizr-"));
bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
"~/Scripts/bootstrap.js",
"~/Scripts/respond.js"));
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/bootstrap.css",
"~/Content/site.css"));
}
}
}
Can't post without padding out the text on this file, so here is my whole layout file:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title - linkofy</title>
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
</head>
<body>
<div class="navbar" style="background-color: LightSteelBlue;">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
@Html.ActionLink("Linkofy", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>@Html.ActionLink("Domains", "Index", "Identifiers")</li>
<li>@Html.ActionLink("Clients", "Index", "Clients")</li>
<li>@Html.ActionLink("Links", "Index", "Links")</li>
<li>@Html.ActionLink("Status", "Index", "Status")</li>
</ul>
@Html.Partial("_LoginPartial")
</div>
</div>
</div>
<div class="container body-content">
@RenderBody()
<hr />
<footer>
<p>© @DateTime.Now.Year - Orb Online - Liam Cook</p>
</footer>
</div>
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
@RenderSection("scripts", required: false)
@RenderSection("Styles", required: false)
</body>
</html>

