function logBoxAjaxCall(event){
  event.preventDefault();
  $target = $(event.target);
  console.log($target)
  $.ajax({
    type: $target.attr('method'),
    url: $target.attr('action'),
    data: $target.serialize()
  }).done(function(response){
    $('.userInfoCont').replaceWith(response);
  });
};

function friendsAjaxCall(event){
  event.preventDefault();
  $target = $(event.target);
  $.ajax({
    type: $target.attr('method'),
    url: $target.attr('action'),
    data: {user_id: parseInt($('#userID').val()), friend_id: parseInt($target.children('#friendID').val())}
  }).done(function(response){
    $('#friends').children('ul').replaceWith(response)
  });
};

function friendsEditAjaxCall(event){
  event.preventDefault();
  $target = $(event.target);
  $.ajax({
    type: $target.children('input[name="_method"]').val(),
    url: $target.attr('action')
  }).done(function(response){
    $('#friends').children('ul').replaceWith(response)
  });
};

$(document).ready(function() {
  $('.userInfoCont').on('click', '#registerNow', logBoxAjaxCall);
  $('#registerBox').on('click', '#loginNow', logBoxAjaxCall);
  $('#friends').on('click', '#friendslistButton', friendsAjaxCall);
  $('#friends').on('click', '#friendrequestButton', friendsAjaxCall);
  $('#friends').on('submit', '.button_to', friendsEditAjaxCall);

  $('#friend_page_add').on('submit', '.add', friendsEditAjaxCall);

  $('#friends').on('submit', '#search', function(event){
    event.preventDefault();
    $target = $(event.target);
    $.ajax({
      type: $target.attr('method'),
      url: $target.attr('action'),
      data: $target.serialize()
    }).done(function(response){
      $('#friends').children('ul').replaceWith(response);
      $target.children('input[name="email"]').val("");
    });
  });

  $('#bio').on('click', 'p', function(event){
    $('#bioEdit').text('Save Change');
  });

  $('#friend_page_add').on('click', '#add_back_button', function(event){
    event.preventDefault();
    $target = $(event.target);
    $.ajax({
      type: 'patch',
      url: $target.attr('action')
    }).done(function(response){
      $('#friend_page_add').text('request sent')
    });
  });

  $('#friend_page_add').on('click', '#send_request_button', function(event){
    event.preventDefault();
    $target = $(event.target);
    $.ajax({
      type: $target.siblings('input[name="_method"]').val(),
      url: $target.attr('action')
    }).done(function(response){
      $target.replaceWith("<p id='request_sent_p'>Request sent</p>")
    });
  });

  $('#bio').on('click', '#bioEdit', function(event){
    event.preventDefault();
    $target = $(event.target);
    $target.text('Saving...');
    $.ajax({
      type: 'PUT',
      url: $target.attr('action'),
      data: {user_id: parseInt($('#userID').val()), newbio: $target.siblings('p').text()}
    }).done(function(response){
      $target.text('Saved');
    });
  });


  $('#possiblevalues').on('click', 'a', function(event){
    event.preventDefault();
    console.log('fail');
    $target = $(event.target)
    $.ajax({
      type: 'post',
      url: $target.attr('action'),
      data: {friend_id: parseInt($('#userID').val()), value_id: parseInt($target.attr('value'))}
    }).done(function(response){
      $target.closest('#possiblevalues').siblings('div').children('p').replaceWith(response);
    });
  });


  $('#addvalue_form').on('submit', function(event){
    event.preventDefault();
    $target = $(event.target)
    console.log($target);
    $.ajax({
      type: 'post',
      url: $target.attr('action'),
      data: $target.serialize()
    }).done(function(response){
      $target.parent().siblings().children('p').replaceWith(response);
      $target.children('input[name=\'word\']').val("");
    });
  });

  $('#morevalue_button').on('click', function(event){
    event.preventDefault();
    $target = $(event.target)
    $target.text('Loading...');
    $.ajax({
      type: 'GET',
      url: location.pathname+'/values'
    }).done(function(response){
      $target.siblings('p').replaceWith(response);
      $target.text('More Values');
    });
  });



});





@@ -955,16 +955,341 @@
 %7D);%0A%7D;%0A%0A
+function saveBio(event)%7B%0A  event.preventDefault();%0A  $target = $(event.target);%0A  $target.text('Saving...');%0A  $.ajax(%7B%0A    type: 'PUT',%0A    url: $target.attr('action'),%0A    data: %7Buser_id: parseInt($('#userID').val()), newbio: $target.siblings('p').text()%7D%0A  %7D).done(function(response)%7B%0A    $target.text('Saved');%0A  %7D);%0A%7D;%0A%0A
 $(docume
@@ -1431,32 +1431,99 @@
 ogBoxAjaxCall);%0A
+  $('#friend_page_add').on('submit', '.add', friendsEditAjaxCall);%0A
   $('#friends').
@@ -1636,32 +1636,32 @@
 iendsAjaxCall);%0A
+
   $('#friends').
@@ -1714,76 +1714,8 @@
 );%0A%0A
-  $('#friend_page_add').on('submit', '.add', friendsEditAjaxCall);%0A%0A
   $(
@@ -2890,344 +2890,15 @@
 t', 
-function(event)%7B%0A    event.preventDefault();%0A    $target = $(event.target);%0A    $target.text('Saving...');%0A    $.ajax(%7B%0A      type: 'PUT',%0A      url: $target.attr('action'),%0A      data: %7Buser_id: parseInt($('#userID').val()), newbio: $target.siblings('p').text()%7D%0A    %7D).done(function(response)%7B%0A      $target.text('Saved');%0A    %7D);%0A  %7D
+saveBio
 );%0A%0A

Move code around.