title: Should response text be set in the backend or front?
body: <p>I'm building a site that uses quite a lot of AJAX requests to sign in, update information and add content. </p>
  
  <p>I am currently using CodeIgnitor for the project and wondering whether a response of either success </p>
  
  <pre><code>"Success, you have updated your profile"
  </code></pre>
  
  <p>or error </p>
  
  <pre><code>"There was an error updating your profile!"
  </code></pre>
  
  <p>should have a message that is set in the JS function or if it should simply be put in the JSON response but unsure which is better for future development. What do you suggest?</p>
  
  <p>The message is to be used in a toast/message notification on the page on request callback.</p>
  
  <p>My original idea was to have a basic key value array somewhere in the project like so:</p>
  
  <pre><code>array(
      100 =&gt; "Cannot update profile",
      101 =&gt; "Successfully updated profile",
      102 =&gt; "Cannot authenticate user",
      103 =&gt; "Successfully authenticated!",
      104 =&gt; "Unable to load profile data"
  )
  </code></pre>
  
  <p>But thought this might get confusing and sluggish over time.</p>