Commit 0d08b06d 0d08b06ddcc4fb81098fa19ba78d2800e3cef689 by Adnan Ahmad

Update jquery.js

1 parent 61b78aa1
......@@ -101,7 +101,7 @@ $(document).ready(function(){
SubItem = "";
item += "</div>";
}
$("#mainRightDiv").append(item);
$("#mainRightDiv").html(item);
}
//DisplayItems();
......@@ -120,6 +120,29 @@ $(document).ready(function(){
DisplayItems(items);
});
// Sort By Albums
// Ascending
$('body').on('click', '.AssItem',function () {
$(this).click(function(){
items.sort(function(a,b) {return (a.song > b.song) ? 1 : ((b.song > a.song) ? -1 : 0);} );
$("#mainRightDiv").empty();
DisplayItems(items);
});
});
// Descending
$('body').on('click', '.DessItem',function () {
$(this).click(function(){
items.sort(function(a,b) {return (a.song > b.song) ? -1 : ((b.song > a.song) ? 1 : 0);} );
$("#mainRightDiv").empty();
DisplayItems(items);
});
});
// Search By Singer Name
$("#SearchByArtistName").keyup(function(){
SearchValue = $(this).val();
......@@ -180,10 +203,21 @@ $('#item_form').on('submit', function (e) {
contentType: false,
success: function (info) {
document.getElementById("item_form").reset();
$.ajax({
type:'GET',
url: '/Assignments/get.php',
success: function (data){
items = JSON.parse(data);
console.log('Second ajax');
DisplayItems(items);
}
});
alert(info);
}
});
});
// update items
......@@ -216,9 +250,19 @@ $('#item_form').on('submit', function (e) {
url: '/Assignments/database.php',
data:{'id':id, 'action':action},
success: function (info){
$.ajax({
type:'GET',
url: '/Assignments/get.php',
success: function (data){
items = JSON.parse(data);
console.log('second ajax');
DisplayItems(items);
}
});
alert(info);
}
});
}
......