title: How to pass foreign key to json data when doing ajax call?
body: <p>I am facing some confusion about using ajax to post data to a table that contains foreign key in another table. I can do this with object binding with spring pojo but I am trying to create a program that handles client and server side data transfer purely in <code>JSON</code> format.</p>
  
  <p>For example, I have a one to many relationship between <code>Student</code> and <code>Grade</code> table. The foreign key in the grade table is <code>student_id</code>.</p>
  
  <p>Now if I am trying to do an insert in the <code>grade</code> table with the student id = 1. What the json data should look like?</p>
  
  <p>Assuming grade table contains these three columns: </p>
  
  <p><code>grade_Id, grade_received, student_id_fk</code> </p>
  
  <p>If without the foreign key, I can pass the json data like this:</p>
  
  <pre><code>{
      "grade_Id": 2,
      "grade_received": "A"
  }
  </code></pre>
  
  <p>What do i need to change if i need the json data contains the <code>student_id_fk</code>?</p>