AJAX call and data return through JSON in ROR

Hello all,

This could be a tootally boonie question. i am trying to do this very simple app. I have a simple form where user enters data,once entered, i add that data in a div 'data' . which works fine but i want to save that data perodically(all the data in DIV 'data') or if user hits a save button with each data row.

Now one thing i am not sure about that when user hits button 'save data; for a row,i execute the following

new Ajax.Request('/saveData', {method: 'post',asynchronous:true, evalScripts:true,onSuccess:DoASNeeded()});

which saves the data but i am not sure how to retrieve the primarky key of saved record and update it async. to that row. i am not sure how to retrieve PK of saved record and use it later for any modifications.

please help