I build some little mvc asp.net project to check some function of the OutBrain API.
I made a input type of text which get MarketerI ID and should return his name (from the server). But when i push the button nothing happen and i really dont have a clue why and whould glad to get some help !
Thanks
My code :
outBrain.js File
$("#buttonB").on('click', function () {
getMarketer();
});
function getMarketer() {
$.ajax({
url: "/home/GetOutBrainMarketers",
data: { id: $("marketerID").val() },
success: function (result) {
var marketer = JSON.parse(result);
document.getElementById("nameMarketer").innerHTML = (marketer.name);
}
});
}
cshtml File (which include the script file path):
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="~/Scripts/outBrain.js"></script>
@{
ViewBag.Title = "Home Page";
}
<br />
<div class="details">
<label>Enter Marketer ID</label>
<input type="text" class="form-control" id="marketerID">
<input type="button" class="btn btn-default" value="OK" id="buttonB" />
<section class="details">
<div class="name">
<label>Name</label>
<label id="nameMarketer"></label>
</div>
</section>
</div>
There is also the code of the controller but dont see a point to add it.