In this task we need to get some bounties from stack overflow. We'll want to initialize a part of our script once the welcome page of our application has been initialized. Once this happens we can attach a handler for the <button>
on the page to trigger an AJAX request using the getBounties()
function that we add in the last part.
Inside the outer function, but after the getBounties()
function in bounty-hunter.js
, add the following code:
$(document).on("pageinit", "#welcome", function () { $("#search").on("click", function () { $(this).closest(".ui-btn") .addClass("ui-disabled"); tags = $("tags").val(); getBounties(1, function(data) { data.currentPage = 1; localStorage.setItem("res", JSON.stringify(data)); $.mobile.changePage("bounty-hunter-list.html", { transition: "slide" }); }); }); });