Reputation: 618
I'm new to ajax, and I quite don't understand how could I output json
objects with console.log
.
Without added .val()
output is working, but when I add .val()
to the search query, it doesn't seem to work.
$( document ).ready(function() {
$(".form-inline").submit(doStuff);
});
function doStuff(e){
e.preventDefault();
var input = $("#nanizankaInput").val();
var link = "http://api.tvmaze.com/search/shows?q=";
link = link + input;
$.ajax({
url: 'link',
method: 'GET',
success: function (data) {
console.log(data);
}
});
}
FiddleJS: https://jsfiddle.net/Ld9f0ant/4/
Upvotes: 0
Views: 34
Reputation: 6742
I don't think I've completely understood everything in the question, but I can see a problem with the code.
Maybe replace url: 'link'
with url: link
.
Upvotes: 4