I am trying to fetch movie information from omdbapi.So far i have this code which is extracting data from imdb using omdb api.But i want import that data to my database.how do i accomplish that.
my code look like this
<form>
<input type="text" id="tst"/>
<input type="button" value="search" id="btn"/>
</form>
<table class="table table-hover" id="imdb">
<thead>
<tr>
<th>Poster</th>
<th>Title</th>
<th>Year</th>
<th>Rated</th>
<th>Runtime</th>
<th>Genre</th>
<th>Director</th>
<th>Actors</th>
<th>Plot</th>
</tr>
</thead>
<tbody></tbody>
</table>
This is jquery code i am using to fetch the movie information
$(document).ready(function () {
$('#btn').click(function(){
var imdbid=$('#tst').val();
var url = "http://www.omdbapi.com/?i="+imdbid+"&plot=short&r=json"
$.ajax({
url:url,
dataType:'json',
success:function (json) {
var tr;
tr = $('<tr/>');
tr.append("<td><img src=" + json.Poster + " width='200' height='297'></td>");
tr.append("<td>" + json.Title + "</td>");
tr.append("<td>" + json.Year + "</td>");
tr.append("<td>" + json.Rated + "</td>");
tr.append("<td>" + json.Runtime + "</td>");
tr.append("<td>" + json.Genre + "</td>");
tr.append("<td>" + json.Director + "</td>");
tr.append("<td>" + json.Actors + "</td>");
tr.append("<td>" + json.Plot + "</td>");
$('#imdb').append(tr);
}
})
})
});