Ok so I am running 3 searches side by side threw and API when the user enters a title and hits search they all work fine.
I have been asked however to allow the user to control what information is printed in what div (Left beaning first and far right beaning last)
By default I am just printing the information out into the 3 divs in the order of movies, tv and games.
Here is an example of the movie print out function as u can see it is being sent to pref 1 be defualt
Movie sent to pref 1
success: function (data) {
var table = '<table>';
$.each(data.results, function (key, value) {
table += '<tr><td class="results-img"><img src="http://image.tmdb.org/t/p/w500' + value.poster_path + '" alt="" width="150" height="200"></td><td class="results-title"><h3>' + value.original_title + '</h3></td><td class="results-date">' + value.release_date +
'</td><td class="results-search-btn"><button class="search-btn" id="MoreInfo">Few More Info</button></td></tr>';
});
$('#pref1').html(table);
}
Tv sent to pref 2
success: function (data) {
var table = '<table>';
$.each(data.results, function (key, value) {
table += '<tr><td class="results-img"><img src="http://image.tmdb.org/t/p/w500' + value.poster_path + '" alt="" width="150" height="200"></td><td class="results-title"><h3>' + value.original_name + '</h3></td><td class="results-date">' + value.first_air_date +
'</td><td class="results-search-btn"><button class="search-btn" id="MoreInfo">Few More Info</button></td></tr>';
});
$('#pref2').html(table);
}
Games sent to pref 3
window.gamer = function (data) {
var table = '<table>';
$.each(data.results, function (key, value) {
var image = "";
if (value.image) {
// either icon_url,medium_url,screen_url,small_url,super_ur,thumb_url or tiny_url
image = "<img src='" + value.image.thumb_url + "'/>";
}
table += '<tr><td>' + image + '</td><td td class="results-title"><h3>' + value.name + '</h3></td><td class="results-search-btn"><button class="search-btn" id="MoreInfo">Few More Info</button></td></tr>';
});
//This is where it tells it to print the content to
table += '</table>';
$('#pref3').html(table);
}
I want to use 3 dropdown boxes to allow the user to decide what gets loaded where
<select>
<option value="M">1</option>
<option value="M">Movie</option>
<option value="T">Tv</option>
<option value="G">Games</option>
</select>
<select>
<option value="M">2</option>
<option value="M">Movie</option>
<option value="T">Tv</option>
<option value="G">Games</option>
</select>
<select>
<option value="M">3</option>
<option value="M">Movie</option>
<option value="T">Tv</option>
<option value="G">Games</option>
</select>
And here is the divs they go in
<div id="container">
<div id="pref1"></div>
<div id="pref2"></div>
<div id="pref3"></div>
</div>
a loop or if statement should do it I am just having problems writing them in and connecting the dropdown options.
Any help is welcome