Skip to content

Commit

Permalink
Moved ajax function to js directory
Browse files Browse the repository at this point in the history
  • Loading branch information
allisonglittle committed Dec 2, 2021
1 parent baf7c07 commit b822280
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions library-express/patrons.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ module.exports = function () {
router.get('/:id', function (req, res) {
callbackCount = 0;
var context = {};
context.jsscripts = ["selectTitle.js", "updatePatron.js"];
context.jsscripts = ["selectTitle.js"];
var mysql = req.app.get('mysql');
getPatron(res, mysql, context, req.params.id, complete);
getTitles(res, mysql, context, complete);
Expand All @@ -138,7 +138,7 @@ module.exports = function () {
});


/* Testing new way to update patron. */
/* Update patron and redirect to patrons page. */
router.post('/:id', function (req, res) {
var mysql = req.app.get('mysql');
console.log(req.body)
Expand Down
File renamed without changes.
10 changes: 8 additions & 2 deletions library-express/views/update_patrons.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@
</p>
<p><input type="submit" value="Submit"></p>
</form>
<script src="../public/selectTitle.js"></script>
<script defer>selectTitle({{patron.favoriteTitle}});</script>
{{!--
<script src="/public/js/selectTitle.js"></script> --}}
<script>
function selectTitle(ISBN) {
$("#title-selector").val(ISBN);
}
</script>
<script defer>selectTitle({{ patron.favoriteTitle }});</script>
</main>

0 comments on commit b822280

Please sign in to comment.